批处理schtasks命令一键添加全自动定期清理系统垃圾任务计划 每月循环执行 系统自带的命令 无需安装任何软件 支持Windows全版本系统执行

        简单讲就是用命令创建一个循环任务计划,定时调用Windows系统自带的磁盘清理工具cleanmgr工具实现全自动清理系统的方法。此方法,无需第三方软件或工具插件,直接运行系统自带的工具,报错机率降低,方便快捷,循环执行,一劳永逸!喜欢的话,请点赞关注轶软工作室吧。

        此为纯批处理执行代码,直接复制到记事本,做成 .bat 文件后,右键以管理员身份运行即可,此清理的项目查看运行命令【cleanmgr /sageset:99】程序将清理所有项,包括回收站内容,不喜欢的话,不要执行,如果误操作,可以运行命令【taskschd.msc】点左侧首项任务计划程序找到【自动清理系统垃圾】那一项任务计划删除即可。

@echo off
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Active Setup Temp Folders" /f /v "StateFlags0099" /t REG_DWORD /d "2" >nul 2>nul
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\D3D Shader Cache" /f /v "StateFlags0099" /t REG_DWORD /d "2" >nul 2>nul
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Delivery Optimization Files" /f /v "StateFlags0099" /t REG_DWORD /d "2" >nul 2>nul
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Downloaded Program Files" /f /v "StateFlags0099" /t REG_DWORD /d "2" >nul 2>nul
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Internet Cache Files" /f /v "StateFlags0099" /t REG_DWORD /d "2" >nul 2>nul
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Language Pack" /f /v "StateFlags0099" /t REG_DWORD /d "2" >nul 2>nul
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Memory Dump Files" /f /v "StateFlags0099" /t REG_DWORD /d "2" >nul 2>nul
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Old ChkDsk Files" /f /v "StateFlags0099" /t REG_DWORD /d "2" >nul 2>nul
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Previous Installations" /f /v "StateFlags0099" /t REG_DWORD /d "2" >nul 2>nul
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Recycle Bin" /f /v "StateFlags0099" /t REG_DWORD /d "2" >nul 2>nul
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Service Pack Cleanup" /f /v "StateFlags0099" /t REG_DWORD /d "2" >nul 2>nul
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Setup Log Files" /f /v "StateFlags0099" /t REG_DWORD /d "2" >nul 2>nul
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\System error memory dump files" /f /v "StateFlags0099" /t REG_DWORD /d "2" >nul 2>nul
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\System error minidump files" /f /v "StateFlags0099" /t REG_DWORD /d "2" >nul 2>nul
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Temporary Files" /f /v "StateFlags0099" /t REG_DWORD /d "2" >nul 2>nul
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Temporary Setup Files" /f /v "StateFlags0099" /t REG_DWORD /d "2" >nul 2>nul
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Thumbnail Cache" /f /v "StateFlags0099" /t REG_DWORD /d "2" >nul 2>nul
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Update Cleanup" /f /v "StateFlags0099" /t REG_DWORD /d "2" >nul 2>nul
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Upgrade Discarded Files" /f /v "StateFlags0099" /t REG_DWORD /d "2" >nul 2>nul
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\User file versions" /f /v "StateFlags0099" /t REG_DWORD /d "2" >nul 2>nul
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Windows Error Reporting Archive Files" /f /v "StateFlags0099" /t REG_DWORD /d "2" >nul 2>nul
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Windows Error Reporting Files" /f /v "StateFlags0099" /t REG_DWORD /d "2" >nul 2>nul
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Windows Error Reporting Queue Files" /f /v "StateFlags0099" /t REG_DWORD /d "2" >nul 2>nul
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Windows Error Reporting System Archive Files" /f /v "StateFlags0099" /t REG_DWORD /d "2" >nul 2>nul
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Windows Error Reporting System Queue Files" /f /v "StateFlags0099" /t REG_DWORD /d "2" >nul 2>nul
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Windows Upgrade Log Files" /f /v "StateFlags0099" /t REG_DWORD /d "2" >nul 2>nul
schtasks /create /tn "自动清理系统垃圾" /tr "cleanmgr /sagerun:99" /sc monthly /mo first /d fri /st 12:00:00 /rl highest

        以上是代码内容,最后一条也可以根据自己时间需求进行修改,还有什么问题留言解答,感谢关注轶软工作室。

你可能感兴趣的:(日常,命令脚本,办公应用,windows,microsoft,服务器)