@echo off :: 考虑到程序并非都安装在系统盘下,所以还要用!str:~-1!来截取盘符 :: 如果路径中含有N个中文字符的话,此路径的最后N个字符将不显示(一个中文字符占两个字符位) :: code by jm 2006-7-27 setlocal enabledelayedexpansion echo. echo 开机自启动的程序有: echo. for /f "skip=4 tokens=1* delims=:" %%i in ('reg query HKLM\Software\Microsoft\Windows\CurrentVersion\Run') do ( set str=%%i set var=%%j set "var=!var:"=!" if not "!var:~-1!"=="=" echo !str:~-1!:!var! ) pause>nul
复制代码 代码如下:
@ECHO OFF SET RQ=REG QUERY SET CU=HKEY_CURRENT_USER SET LM=HKEY_LOCAL_MACHINE SET FS=FINDSTR /V /B "! HKEY_"^|FINDSTR "." SET WS=\Software\Microsoft\Windows\CurrentVersion\ SET WT=\Software\Microsoft\Windows NT\CurrentVersion\ SET CK=\SYSTEM\CurrentControlSet\Control\Session Manager SET RT=LoadUserinitWindowsWinlogonShellRunOnceExPolicies\Explorer\RunBootExecute SET RP=ECHO -------------------------------------------------------------------------------
%RP%ECHO %ALLUSERSPROFILE%^%USERNAME%\「开始」菜单\程序\启动 FOR %%i IN (ALLUSERSPROFILE;USERPROFILE) DO CALL DIR /B /S "%%%%i%%\「开始」菜单\程序\启动" %RP%
FOR /F "tokens=1-8 delims=: " %%A IN ('FINDSTR /B "::" "%~nx0"') DO ( CALL :REGQUERY 1 %%A %%B %%C %%D %%E %%F %%G ">NUL" ) SET /A 1/%~1 2>NULGOTO :EOF SET /p CONU=导出为文本文档?(Y/N): ECHO %CONU%|FIND /I "N" 1>NUL 21GOTO :EOF CALL %~nx0 1 >%~n0%.txt ECHO file list:%~dpn0%.txt PAUSE>NUL"%~dpn0%.txt" GOTO :EOF ::CU WT 12 7 V 0 4 ::LM WT 19 8 V 4 8 ::LM WT 19 8 V 27 5 ::CU WS 32 3 S 0 0 ::LM WS 32 3 S 0 0 ::CU WS 32 7 S 0 0 ::LM WS 32 7 S 0 0 ::CU WS 32 9 S 0 0 ::LM WS 32 9 S 0 0 ::CU WS 41 21 S 0 0 ::LM WS 41 21 S 0 0 ::LM CK 0 0 V 62 11 :REGQUERY CALL SET PR=%%%~2%%%%%~3%%%%rt:~%~4,%~5%%CALL SET PZ=%%rt:~%~7,%~8%% ECHO [%PR%] %~9%RQ% "%PR%" /%6 %PZ% 2>NUL|%FS% %~9%RP%SET/A 1/%1 2>NULCALL %0 0 %2 %3 %4 %5 %6 %7 %8 GOTO :EOF