自制实用批处理系统工具

2025-11-08 19:46:09

1、右键点击桌面空白处→新建→文本文档。

自制实用批处理系统工具

2、双击打开新建的记事本,输入以下批处理代码:

:menu

cls

@echo off

title ——Windows 7 实用批处理——

echo ——————————————————————————

echo             请选择要进行的操作,然后按回车

echo ——————————————————————————

echo.

echo 1.系统自带磁盘清理工具的增强功能设置

echo.

echo 2.系统自带磁盘清理工具的增强功能执行

echo.

echo 3.清理休眠文件,系统盘可以空出与内存一样大的空间!

echo.

echo 4.清理右下角通知区域图标记录,全部图标记录将删除!

echo.

echo 5.清理Windows 7的垃圾文件,旧文件

echo.

echo 6.添加右键管理员权限(实用)

echo.

echo q.退出!

echo.

:cho

set /p choice=请选择:

IF NOT "%choice%"=="" SET choice=%choice:~0,1%

if /i "%choice%"=="1" goto s1

if /i "%choice%"=="2" goto s2

if /i "%choice%"=="3" goto s3

if /i "%choice%"=="4" goto s4

if /i "%choice%"=="5" goto s5

if /i "%choice%"=="6" goto s6

if /i "%choice%"=="q" goto end

echo 选择无效,请重新输入……

echo.

goto cho

:s1

cls

echo 请选择要清理的文件类型,确定后自动返回。

cleanmgr /sageset:99

echo 设置完毕后请选择“2”执行清理功能。

pause

goto menu

:s2

cls

echo 正在执行清理功能,如果速度太慢可以选择取消!

cleanmgr /sagerun:99

echo 清理完毕!

pause

goto menu

:s3

cls

echo 本功能需要系统取消休眠功能!

echo 注意!请首先把电源选项中的“使计算机进入睡眠状态”

echo 设为“从不”,保存后再继续执行,否则设置会失效!

pause

powercfg -h off

goto menu

:s4

cls

reg delete "HKCU\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\TrayNotify" /v "PastIconsStream" /f

reg delete "HKCU\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\TrayNotify" /v "IconStreams" /f

echo 通知区域的全部图标记录已删除!

echo 现在重启explorer.exe进程!

pause

taskkill /f /im explorer.exe

start explorer.exe

goto menu

:s5

@echo off

echo 正在清除系统垃圾文件,请稍等……

echo 清理垃圾文件,速度由电脑文件大小而定。

echo 在没看到结尾信息时请勿关闭本窗口。

echo 正在清除系统垃圾文件,请稍后……

echo 删除补丁备份目录……

RD %windir%\$hf_mig$ /Q /S

dir %windir%\$NtUninstall* /a:d /b >%windir%\update_.txt

for /f %%i in (%windir%\update_.txt) do rd %windir%\%%i /s /q

del %windir%\update_.txt /f /q

echo 删除补丁安装记录内容

del %windir%\KB*.log /f /q

echo 删除系统盘目录下临时文件

del /f /s /q %systemdrive%\*.tmp

del /f /s /q %systemdrive%\*._mp

echo 删除系统盘目录下日志文件

del /f /s /q %systemdrive%\*.log

echo 删除系统盘目录下GID临时文件

del /f /s /q %systemdrive%\*.gid

echo 删除系统目录下磁盘扫临时文件

del /f /s /q %systemdrive%\*.chk

echo 删除系统目录下*.old文件

del /f /s /q %systemdrive%\*.old

echo 删除回收站的无用文件

del /f /s /q %systemdrive%\recycled\*.*

echo 删除系统目录下备份文件

del /f /s /q %windir%\*.bak

echo 删除应用程序临时文件

del /f /s /q %windir%\prefetch\*.*

echo 删除系统维护等操作产生的临时文件

rd /s /q %windir%\temp md %windir%\temp

echo 删除internet临时文件

del /f /s /q "%userprofile%\local settings\temporary internet files\*.*"

echo 删除当前用户日常操作临时文件

del /f /s /q "%userprofile%\local settings\temp\*.*"

echo 删除打开文件记录快捷方式

del /f /s /q "%userprofile%\recent\*.*"

pause

goto menu

:s6

cls

echo 正在添加右键菜单选项……

echo Windows Registry Editor Version 5.00>>reg_.reg

echo [HKEY_CLASSES_ROOT\*\shell\runas]>>reg_.reg

echo @="添加管理员权限">>reg_.reg

echo "NoWorkingDirectory"="">>reg_.reg

echo [HKEY_CLASSES_ROOT\*\shell\runas\command]>>reg_.reg

echo @="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant administrators:F">>reg_.reg

echo "IsolatedCommand"="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant administrators:F">>reg_.reg

echo [HKEY_CLASSES_ROOT\exefile\shell\runas2]>>reg_.reg

echo @="添加管理员权限">>reg_.reg

echo "NoWorkingDirectory"="">>reg_.reg

echo [HKEY_CLASSES_ROOT\exefile\shell\runas2\command]>>reg_.reg

echo @="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant administrators:F">>reg_.reg

echo "IsolatedCommand"="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant administrators:F">>reg_.reg

echo [HKEY_CLASSES_ROOT\Directory\shell\runas]>>reg_.reg

echo @="添加管理员权限">>reg_.reg

echo "NoWorkingDirectory"="">>reg_.reg

echo [HKEY_CLASSES_ROOT\Directory\shell\runas\command]>>reg_.reg

echo @="cmd.exe /c takeown /f \"%1\" /r /d y && icacls \"%1\" /grant administrators:F /t">>reg_.reg

echo "IsolatedCommand"="cmd.exe /c takeown /f \"%1\" /r /d y && icacls \"%1\" /grant administrators:F /t">>reg_.reg

regedit /s reg_.reg

del /q /f reg_.reg

echo 已经添加完毕。

pause

goto menu

:end

exit

自制实用批处理系统工具

3、文件→另存为。

自制实用批处理系统工具

4、取个名(随意):实用批处理系统工具,关键是后面的扩展名为.bat→保存。

自制实用批处理系统工具

5、双击打开制作好的批处理工具。

自制实用批处理系统工具

6、按照提示,就能使用该功能了,先输入数字→再按回车键。

自制实用批处理系统工具

7、各项功能分别为:

①系统自带磁盘清理工具的增强设置

②系统自带磁盘清理工具的增强功能执行

③清理休眠文件,系统盘可以空出与内存一样大的空间!

④.清理右下角通知区域图标记录,全部图标记录将删除!

⑤清理Windows 7的垃圾文件,旧文件

⑥添加右键管理员权限(实用)

Q退出

自制实用批处理系统工具

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢