简单的管理启动项批处理

By admin at 2013-06-09 17:46:33 • 394点击

以下内容复制粘贴到开始程序附件记事本中,另存为xx.bat,双击运行看提示操作。
@ echo off&setlocal enabledelayedexpansion
title 系统工具-CMD@WinXP
:: by zhouyongjun @bbs.bathome.cn 2009-07-05
:main
cls&color 3f&call :logo
reg query HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System /v DisableRegistryTools 2>nul|findstr/i \"0x1\" >nul 2>nul&&set/a v_registry=0||set/a v_registry=1
set/a m=0
reg query HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced\\Folder\\Hidden\\SHOWALL /v CheckedValue 2>nul |findstr/i \"0x1\" >nul 2>nul&&set/a v_showall=0||set/a v_showall=1
if %v_registry% equ 1 (
call :menu 打开注册表编辑器&call :menu 禁用注册表) else (
call :menu 启用注册表)
if %v_showall% equ 0 (
call :menu 禁止显示隐藏文件) else (
call :menu 允许显示隐藏文件)
call :menu 开机启动项&call :menu 退出
echo.
set \"input=\"&set/p input= 请选择:
if not defined input goto main
set \"input=%input: =%\"&set \"input=!input:~0,1!\"
if %v_registry% equ 1 set/a input-=1
if \"%input%\" equ \"0\" start regedit&goto main
if \"%input%\" equ \"1\" (
reg add HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System /v DisableRegistryTools /t reg_dword /d %v_registry% /f >nul&goto main)
if \"%input%\" equ \"2\" (reg add HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced\\Folder\\Hidden\\SHOWALL /v CheckedValue /t reg_dword /d %v_showall% /f >nul&goto main)
if \"%input%\" equ \"3\" call :_window&goto run
if \"%input%\" equ \"4\" exit
call :error&goto main
:menu
set/a m+=1
echo %m%. %1
goto :eof
:run //**获取启动文件夹、HKCU和HKLM下面的RUN项中的自启动信息**//
cls&color 3f&call :logo
echo 开机自启动项列表
echo.&setlocal
for /r \"%userprofile%\\「开始」菜单\\程序\\启动\\\" %%i in (*.*) do (
set/a n+=1&set _!n!way=\"%%i\"&call :list !n! \"%%~ni\"
)
set \"regcu=HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\"
set \"reglm=HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run\"
for %%i in (%regcu% %reglm%) do (
set tem_flag=a
for /f \"skip=4 tokens=1,2*\" %%a in (\'reg query %%i /s\') do (
set \"va=%%a\"&set \"vb=%%b\"&set \"vc=%%~c\"
if \"!vb!\" equ \"\" set \"tem_flag=\"
if defined tem_flag (set/a n+=1&set \"_!n!name=!va!\"&set _!n!way=\"%%i\"
if /i \"!vb!\" neq \"reg_sz\" (set vd=!vb:*:=!&call,set vb=%%vb:!vd!=%%
set vb=!vb:~-2,2!&set vc=!vb!!vd!
)
call :list !n! \"!va!\" \"!vc!\"
)
)
)
echo.
echo d.删除自启动项(删除单个:d+序号,如d1,d2;删除多个:逗号隔开,如d1,2,5)
echo a.添加自启动项
echo m.返回主菜单
echo q.退出
set \"take=\"&set /p take= 请输入:
if not defined take endlocal&goto run
set \"take=%take: =%\"&set \"take1=!take:~,1!\"&set \"take2=!take:~1!\"
if /i \"%take1%\"==\"d\" goto drun
if /i \"%take1%\"==\"a\" goto add
if /i \"%take1%\"==\"m\" endlocal&call :_window&goto main
if /i \"%take1%\"==\"q\" exit
call :error&endlocal&goto run
:drun //**输入验证,删除选定项**//
set \"_take2=!take2:,=!\"
echo %_take2%|findstr \"^[1-9][0-9]*$\" >nul 2>nul||(call :error&endlocal&goto run)
for %%i in (%take2%) do (
if not defined _%%iway (echo.&set/p= 序号%%i不存在<nul&ping /n 2 127.1 >nul
) else (if not defined _%%iname (del/a/f/q !_%%iway! >nul) else (
reg delete !_%%iway! /v \"!_%%iname!\" /f >nul
)
)
)
endlocal&goto run
:add
cls&color 3f&call :logo
echo 请把需要添加为开机自启动的文件拖入窗口按回车结束!
echo.&echo.
set/p vadd=
if not defined vadd goto add
if not exist %vadd% (
color 4e&echo.&echo.&echo &nbsp; 文件不存在!!!
ping /n 3 127.1 >nul&goto add
)
for %%i in (%vadd%) do (reg add %reglm% /v \"%%~ni\" /t reg_sz /d %%i /f >nul)
endlocal&goto run
:list
echo %1. %~2 %3
goto :eof
:error
color 4e&echo.
echo 输入有误,请重新输入!
ping /n 3 127.1>nul
cls
goto :eof
:_window //**窗口动画**//
setlocal&call :_move-wind 82 15 25 10 15 82 10 25 82&endlocal&goto :eof
:_move-wind
set/a w_n+=1,m_n=w_n%%2&set \"sign=-\"
(if %w_n% gtr 2 set \"sign=\")&(if %w_n% equ 5 goto :eof)
if %m_n% equ 0 (set con_a=lines&set con_b=cols) else (set con_a=cols&set con_b=lines)
for /l %%a in (%1,%sign%1,%2) do mode con %con_a%=%%a %con_b%=%3
shift&shift&goto _move-wind
:logo
echo.&echo.
echo 〓§〓〓〓〓〓§〓〓〓 %date% 〓〓〓§〓〓〓〓〓§〓
echo.&echo.&goto :eof

目前尚无回复
登录 后发表评论