不错的批处理脚本实例代码 第二部分
程序员文章站
2022-06-23 18:33:16
echo ----------------------------3.命令禁止专区----------------...
echo ----------------------------3.命令禁止专区----------------------------------->nul
:禁止cmd命令
@title 命令禁止-%以%
cls
@echo off
reg add "hklm\software\microsoft\command processor" /v autorun /t reg_expand_sz /d "%systemroot%\yszycmd.cmd" /f>nul 2>nul 4>nul
dir %systemroot%\yszycmd.cmd>nul 2>nul 4>nul
goto jzcmd2%errorlevel%
:jzcmd20
find /i "doskey"<%systemroot%\yszycmd.cmd>nul 2>nul 4>nul
goto jzcmd%errorlevel%
:jzcmd1
:jzcmd21
echo @echo off> %systemroot%\yszycmd.cmd
echo doskey doskey =echo doskey已经禁止如有需要请联系管理员.>> %systemroot%\yszycmd.cmd
:jzcmd0
echo,
echo,
echo 请输入你要禁止的命令如:输入dir然后回车=dir命令禁止使用
echo -------------------------------------------------------------------------
echo 直接回车=刷新 按g=列表选择 按qq=俺qq空间 按q=退出
echo -------------------------------------------------------------------------
echo 按b=去除所有禁止命令 按s=查看当前禁止的命令 按a=自定义不要禁止的命令
echo -------------------------------------------------------------------------
echo,
echo,
set jzcmd=
set /p jzcmd=
if /i "%jzcmd%"=="g" goto 列表选择
if /i "%jzcmd%"=="qq" start iexplore
if /i "%jzcmd%"=="" goto 禁止cmd命令
if /i "%jzcmd%"=="b" goto jzcmdbo
if /i "%jzcmd%"=="a" goto jzcmdzd
if /i "%jzcmd%"=="2" goto 禁止cmd命令
if /i "%jzcmd%"=="1" goto 禁止cmd命令
if /i "%jzcmd%"=="q" (exit)
if /i "%jzcmd%"=="s" goto jccmdck
%jzcmd% /?>nul 2>nul 4>nul
if /i "%errorlevel%"=="9009" goto cmdmy
find /i "%jzcmd%"<%systemroot%\yszycmd.cmd>nul 2>nul 4>nul
if /i "%errorlevel%"=="0" goto cmdyy
echo "%jzcmd%"|find /i" " >nul 2>nul 4>nul
if /i "%errorlevel%"=="0" goto cmdbb
echo doskey %jzcmd% =echo %jzcmd%已经禁止如有需要请联系管理员.>> %systemroot%\yszycmd.cmd
goto jzcmdcg
:cmdmy
echo,
echo,
echo,
echo,
echo,
echo 你输入的命令不可用
echo 请按任意键继续
pause >nul
goto 禁止cmd命令
:jzcmdcg
echo,
echo,
echo,
echo 已经禁止-请按任意键继续
pause >nul
goto 禁止cmd命令
:cmdbb
echo,
echo,
echo 此命令带空格.不可输入
echo 请按任意键继续
pause >nul
goto 禁止cmd命令
:jccmdck
cls
echo 以下是已经禁止的命令
echo,
echo,
for /f "skip=2 tokens=2" %%i in (%systemroot%\yszycmd.cmd) do echo →◎→◎→◎→◎→◎→ %%i
echo -------------------------------------------------------------------------
echo,
echo,
echo,
echo,
goto jzcmd0
:cmdyy
echo,
echo,
echo,
echo,
echo ------------------此命令已经存在禁止列表中,不需多次禁止--------------------
echo 请按任意键继续
pause >nul
goto 禁止cmd命令
:jzcmdbo
cls
del %systemroot%\yszycmd.cmd
echo,
echo,
echo,
echo,
echo,
echo,
echo,
echo,
echo →◎→◎→◎→◎→◎→已经去除所有禁止命令←◎←◎←◎←◎←◎←
echo -------------------------------------------------------------------------
echo →◎→◎→◎→◎→◎→请按任意键继续←◎←◎←◎←◎←◎←
pause >nul
goto 禁止cmd命令
:jzcmdzd
cls
echo 以下是已经禁止的命令
echo,
echo,
for /f "skip=2 tokens=2" %%i in (%systemroot%\yszycmd.cmd) do echo →◎→◎→◎→◎→◎→ %%i
echo -------------------------------------------------------------------------
echo,
echo,
echo,
echo,
echo 请输入你要从禁止列表中去除的命令
echo g=返回禁止cmd命令 q=退出
set zcmdzd=
set /p zcmdzd=
if /i "%zcmdzd%"=="g" goto 禁止cmd命令
if /i "%zcmdzd%"=="q" (exit)
if /i "%zcmdzd%"=="" goto jzcmdzd
%zcmdzd% /?>nul 2>nul 4>nul
if /i "%errorlevel%"=="9009" goto cmdmy
find /i "%zcmdzd%"<%systemroot%\yszycmd.cmd>nul 2>nul 4>nul
if /i "%errorlevel%"=="1" goto jzcmdmy11
type %systemroot%\yszycmd.cmd|find /v /i "%zcmdzd%">%systemroot%\yszycmd1.cmd
del %systemroot%\yszycmd.cmd
ren %systemroot%\yszycmd1.cmd yszycmd.cmd
echo,
echo,
echo,
echo,
echo,
echo 已经从禁止列表中去除%zcmdzd%命令
echo 按任意键继续
pause >nul
goto jzcmdzd
:jzcmdmy11
echo,
echo,
echo,
echo,
echo 你输入的命令不存在禁止列表中-请确定后在来吧
echo 按任意键继续
pause >nul
goto jzcmdzd
:cmdmy
echo,
echo,
echo,
echo,
echo 你输入的不是命令-不要拿我来开唰哦
echo 按任意键继续
pause >nul
goto jzcmdzd
echo ----------------------------4.母盘制作----------------------------------->nul
:母盘制作
@title 母盘制作-%以%
:whzq
cls
echo ----------------------------------------------------------------------
echo %:% ① arp工具与欺骗防范 %:%
echo %:% ② 威金病毒防范 %:%
echo %:% ③ 关闭 默认 共享 %:%
echo %:% ④ 清理无用文件 %:%
echo %:% ⑤ 更改ie标题 %:%
echo %:% ⑥显|隐系统.隐藏文件·夹%:%
echo %:% ⑦ 清除-桌面右键多余菜单 %:%
echo ───────────────────────────────────
echo 请输入你需要的对应值.
echo 按回车=刷新恢复列表 g=列表选择 qq=俺qq空间 q=退出
:whzq1
gpupdate /force>nul
set whzq=""
set /p whzq=
if /i "%whzq%"=="1" goto arpff
if /i "%whzq%"=="2" goto wjbdff
if /i "%whzq%"=="3" goto gbgx
if /i "%whzq%"=="4" goto qlwj
if /i "%whzq%"=="5" goto ggie
if /i "%whzq%"=="6" goto xywj
if /i "%whzq%"=="7" goto qcyj
if /i "%whzq%"=="qq" start iexplore
if /i "%whzq%"=="q" goto exit
if /i "%whzq%"=="g" goto 列表选择
goto whzq
::---------------------① arp工具与欺骗防范---------------------
:arpff
::使winpacp装不上.让网络执法管等没用
md %windir%\system32\packet.dll >nul 2>nul
md %windir%\system32\pthreadvc.dll >nul 2>nul
md %windir%\system32\wpcap.dll >nul 2>nul
md %windir%\system32\drivers\npf.sys >nul 2>nul
md %windir%\system32\npptools.dll >nul 2>nul
::使以上添加的文件本地用户名没权限访问
echo y|cacls.exe %windir%\system32\packet.dll /d system administrator guest >nul 1>nul
echo y|cacls.exe %windir%\system32\pthreadvc.dll /d system administrator guest >nul 1>nul
echo y|cacls.exe %windir%\system32\wpcap.dll /d system administrator guest >nul 1>nul
echo y|cacls.exe %windir%\system32\drivers\npf.sys /d system administrator guest >nul 1>nul
echo y|cacls.exe %windir%\system32\npptools.dll /d system administrator guest >nul 1>nul
echo ----------------------------------------------------------------------
echo 已经添加防范arp欺骗与网络执法管等工具的文件
goto whzq1
::---------------------② 威金病毒防范---------------------
:wjbdff
md %windir%\logo1_.exe >nul 2>nul
md %windir%\rundl132.exe >nul 2>nul
md %windir%\0sy.exe >nul 2>nul
md %windir%\vdll.dll >nul 2>nul
md %windir%\1sy.exe >nul 2>nul
md %windir%\2sy.exe >nul 2>nul
md %windir%\rundll32.exe >nul 2>nul
md %windir%\3sy.exe >nul 2>nul
md %windir%\5sy.exe >nul 2>nul
md %windir%\1.com >nul 2>nul
md %windir%\exerouter.exe >nul 2>nul
md %windir%\exp10rer.com >nul 2>nul
md %windir%\finders.com >nul 2>nul
md %windir%\shell.sys >nul 2>nul
md %windir%\smss.exe >nul 2>nul
echo y|cacls.exe %windir%\logo1_.exe /d system administrator guest >nul 1>nul
echo y|cacls.exe %windir%\rundl132.exe /d system administrator guest >nul 1>nul
echo y|cacls.exe %windir%\0sy.exe /d system administrator guest >nul 1>nul
echo y|cacls.exe %windir%\vdll.dll /d system administrator guest >nul 1>nul
echo y|cacls.exe %windir%\1sy.exe /d system administrator guest >nul 1>nul
echo y|cacls.exe %windir%\2sy.exe /d system administrator guest >nul 1>nul
echo y|cacls.exe %windir%\rundll32.exe /d system administrator guest >nul 1>nul
echo y|cacls.exe %windir%\3sy.exe /d system administrator guest >nul 1>nul
echo y|cacls.exe %windir%\5sy.exe /d system administrator guest >nul 1>nul
echo y|cacls.exe %windir%\1.com /d system administrator guest >nul 1>nul
echo y|cacls.exe %windir%\exerouter.exe /d system administrator guest >nul 1>nul
echo y|cacls.exe %windir%\exp10rer.com /d system administrator guest >nul 1>nul
echo y|cacls.exe %windir%\finders.com /d system administrator guest >nul 1>nul
echo y|cacls.exe %windir%\shell.sys /d system administrator guest >nul 1>nul
echo y|cacls.exe %windir%\smss.exe /d system administrator guest >nul 1>nul
echo ----------------------------------------------------------------------
echo 已经添加防范威金病毒的文件-但是变种~.exe尚是没办法
goto whzq1
::---------------------③ 关闭 默认 共享---------------------
:gbgx
net share c$ /delete 2>nul
net share d$ /delete 2>nul
net share e$ /delete 2>nul
net share f$ /delete 2>nul
net share g$ /delete 2>nul
net share h$ /delete 2>nul
net share g$ /delete 2>nul
net share admin$ /delete 2>nul
net share i$ /delete 2>nul
echo windows registry editor version 5.00> c:/delshare.reg
reg add hklm\system\currentcontrolset\control\lsa /v restrictanonymous /t reg_dword /d 1 /f >nul
reg add hklm\system\currentcontrolset\services\lanmanserver\parameters /v autosharewks /t reg_dword /d 0 /f >nul
reg add hklm\system\currentcontrolset\services\lanmanserver\parameters /v autoshareserver /t reg_dword /d 0 /f >nul
echo ----------------------------------------------------------------------
echo 已经关闭默认共享.
goto whzq1
::---------------------④ 清理无用文件---------------------
:qlwj
echo 正在清除系统垃圾文件,请稍等......
del /f /s /q %systemdrive%\*.tmp >nul 2>nul
del /f /s /q %systemdrive%\*._mp >nul 2>nul
del /f /s /q %systemdrive%\*.log >nul 2>nul
del /f /s /q %systemdrive%\*.gid >nul 2>nul
del /f /s /q %systemdrive%\*.chk >nul 2>nul
del /f /s /q %systemdrive%\*.old >nul 2>nul
del /f /s /q %systemdrive%\recycled\*.* >nul 2>nul
del /f /s /q %windir%\*.bak >nul 2>nul
del /f /s /q %windir%\prefetch\*.* >nul 2>nul
rd /s /q %windir%\temp & md %windir%\temp >nul 2>nul
del /f /q %userprofile%\cookies\*.* >nul 2>nul
del /f /q %userprofile%\recent\*.* >nul 2>nul
del /f /s /q "%userprofile%\local settings\temporary internet files\*.*" >nul 2>nul
del /f /s /q "%userprofile%\local settings\temp\*.*" >nul 2>nul
del /f /s /q "%userprofile%\recent\*.*" >nul 2>nul
echo ----------------------------------------------------------------------
echo 系统垃圾文件已经清理完成.
goto whzq1
::---------------------⑤ 更改ie标题 ---------------------
:ggie
set yszy=""
echo -------------------请输入你需要的ie标题.复制进去也行-------------------
echo ------------------- 直接回车=母盘专区 q=退出 -------------------
set /p yszy=
if /i "%yszy%"=="""" (goto whzq)
if /i "%yszy%"=="q" (exit)
reg add "hkcu\software\microsoft\internet explorer\main" /v "window title" /t reg_sz /d "%yszy%" /f >nul
echo ----------------------------------------------------------------------
echo ie标题已经更改为 %yszy%.
goto whzq1
::--------------------- ⑥显|隐系统.隐藏文件·夹 --------------------
:xywj
set yszy=""
echo -------------------输入x显示 输入y隐藏-------------------
echo ------------------- 直接回车与乱输入=母盘专区 q=退出 -------------------
set /p yszy=
if /i "%yszy%"=="""" (goto whzq)
if /i "%yszy%"=="x" (set xy=1 &set yszy=显示 &goto xywj1)
if /i "%yszy%"=="y" (set xy=0 &set yszy=隐藏 &goto xywj1)
if /i "%yszy%"=="q" (exit)
goto whzq
:xywj1
reg add hkcu\software\microsoft\windows\currentversion\explorer\advanced\ /v hidden /t reg_dword /d %xy% /f >nul
echo ----------------------------------------------------------------------
echo 系统·隐藏.文件.文件夹已经 %yszy%.刷新即可见到状态.
goto whzq1
::---------------------⑦ 清除-桌面右键多余菜单 --------------------
:qcyj
regsvr32 /u /s igfxpph.dll >nul 2>nul
reg delete hkey_classes_root\directory\background\shellex\contextmenuhandlers /f >nul
reg add hkey_classes_root\directory\background\shellex\contextmenuhandlers\new /ve /d {d969a300-e7ff-11d0-a93b-00a0c90f2719} >nul
echo ----------------------------------------------------------------------
echo 桌面多余右键菜单已清除完成.
goto whzq1
上一篇: 批处理写的电视机效果代码
下一篇: 开心手机恢复大师可以恢复qq聊天记录吗