用批处理列出所有开机启动项的命令
程序员文章站
2022-06-23 18:32:40
下面是jm写的代码,可能对你有用!~ 复制代码 代码如下:@echo off :: 考虑到程序并非都安装在系统盘下,所以还要用!str:~-...
下面是jm写的代码,可能对你有用!~
@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>nul&&goto :eof
set /p conu=导出为文本文档?(y/n):
echo %conu%|find /i "n" 1>nul 2<&1&&goto :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>nul&&call %0 0 %2 %3 %4 %5 %6 %7 %8
goto :eof
复制代码 代码如下:
@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>nul&&goto :eof
set /p conu=导出为文本文档?(y/n):
echo %conu%|find /i "n" 1>nul 2<&1&&goto :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>nul&&call %0 0 %2 %3 %4 %5 %6 %7 %8
goto :eof
上一篇: 利用mshta调用运行js或vbs的
下一篇: pages文本中小写英文怎么变成大写?