@echo off
echo 此脚本由233395367zhmsg编写,适用于Windows操作系统普通用户~
:menu
echo 【Y】运行脚本~【N】退出~
set /p yn=请输入选择后回车确认~
if /i "%yn%"=="y" goto yes
if /i "%yn%"=="n" exit
echo 您输入的有误,请重新输入~&ping 0 -n "2">nul&cls&goto menu
:yes
echo 开始获取管理员权限~
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" /v "c:\windows\system32\cmd.exe" /d "RUNASADMIN" /f
echo 正在准备进行磁盘清理~
echo 开始清除系统垃圾文件,请稍等……
echo 正在删除系统冗余文件……
echo 删除临时文件……
del /f /s /q %systemdrive%\*.tmp
del /f /s /q %systemdrive%\*._mp
echo 删除日志文件……
del /f /s /q %systemdrive%\*.log
echo 删除帮助残留文件……
del /f /s /q %systemdrive%\*.gid
echo 删除恢复文件……
del /f /s /q %systemdrive%\*.chk
echo 删除旧系统文件……
del /f /s /q %systemdrive%\*.old
echo 正在清空系统盘回收站……
del /f /s /q %systemdrive%\Recycled\*.*
del /f /s /q %systemdrive%\Recycler\*.*
del /f /s /q %systemdrive%\$RECYCLER.Bin\*.*
del /f /s /q %systemdrive%\$RECYCLE.Bin\*.*
echo 正在进行深度清理……
echo 删除补丁残留……
del /f /s /q %windir%\Installer\*.msp
echo 删除备份文件……
del /f /s /q %windir%\*.bak
echo 删除预读文件……
del /f /s /q %windir%\prefetch\*.*
echo 优化系统设置……
rd /s /q %windir%\temp
rd /s /q %windir%\tmp
echo 正在重置账户信息……
del /f /q "%userprofile%\cookies\*.*"
echo 正在清空最近使用文档列表……
del /f /s /q "%userprofile%\recent\*.*"
echo 正在删除IE临时文件……
del /f /s /q "%userprofile%\Local Settings\Temporary Internet Files\*.*"
echo 正在删除账户临时文件……
del /f /s /q "%userprofile%\Local Settings\Temp\*.*"
echo 正在删除无用程序扩展……
sfc /purgecache
echo 正在清理磁盘碎片……
defrag %systemdrive%
echo 清除系统垃圾完成~
echo. & pause