可以精简Win10的BAT代码
2026-05-03 14:05:38
发布于:湖南
话不多说,直接上代码!
请使用NSudo运行(使用trustedinstaller权限+启用全部特权)
Windows10.bat:
@echo off
chcp 65001 >nul
cls
title Tiny10 Cleaner + Auto-Elevate + Check
for /f %%i in ('echo prompt $E ^| cmd') do set "ESC=%%i"
set "RED=%ESC%[31m"
set "GREEN=%ESC%[32m"
set "YELLOW=%ESC%[33m"
set "BLUE=%ESC%[34m"
set "PURPLE=%ESC%[35m"
set "CYAN=%ESC%[36m"
set "WHITE=%ESC%[37m"
set "RESET=%ESC%[0m"
fltmc >nul 2>&1 || (echo %YELLOW%Requesting admin privileges...%RESET%&powershell -Command "Start-Process cmd -ArgumentList '/c ""%~f0""' -Verb RunAs" & exit /b)
echo.
echo %CYAN%==============================================================%RESET%
echo %GREEN% 精简 Windows10%RESET%
echo %CYAN%==============================================================%RESET%
echo.
pause
echo %YELLOW%[1/9] 关闭无效进程%RESET%
echo %CYAN%--------------------------------------------------------------%RESET%
echo.
taskkill /im promecefpluginhost.exe -f -t
taskkill /im msedge.exe -f -t
taskkill /im chrome.exe -f -t
taskkill /im wps.exe -f -t
taskkill /im wpscloudsvr.exe -f -t
taskkill /im wpsnotify.exe -f -t
taskkill /im WeChatAppEx.exe -f -t
taskkill /im WeChat.exe -f -t
taskkill /im KuGou.exe -f -t
taskkill /im cloudmusic.exe -f -t
taskkill /im kwmusic.exe -f -t
taskkill /im AndrowsAssistant.exe -f -t
taskkill /im AndrowsStore.exe -f -t
taskkill /im AndrowsSvr.exe -f -t
taskkill /im igfxEM.exe -f -t
taskkill /im igfxtray.exe -f -t
taskkill /im igfxpers.exe -f -t
taskkill /im hkcmd.exe -f -t
taskkill /im amdwmiutil.exe -f -t
taskkill /im radeonsoftware.exe -f -t
taskkill /im nvtray.exe -f -t
taskkill /im nvcontainer.exe -f -t
taskkill /im XboxApp.exe -f -t
taskkill /im GameBar.exe -f -t
taskkill /im GameBarPresenceWriter.exe -f -t
taskkill /im Gamedvr.exe -f -t
taskkill /im wermgr.exe -f -t
taskkill /im werfault.exe -f -t
taskkill /im SearchApp.exe -f -t
taskkill /im Cortana.exe -f -t
taskkill /im wsappx.exe -f -t
taskkill /im Clipchamp.exe -f -t
taskkill /im StickyNotes.exe -f -t
taskkill /im Paint3d.exe -f -t
taskkill /im FeedbackHub.exe -f -t
taskkill /im QQ.exe -f -t
taskkill /im TIM.exe -f -t
taskkill /im QQProtect.exe -f -t
taskkill /im DingTalk.exe -f -t
taskkill /im WXWork.exe -f -t
taskkill /im Thunder.exe -f -t
taskkill /im BaiduNetdisk.exe -f -t
taskkill /im 360tray.exe -f -t
taskkill /im 360sd.exe -f -t
taskkill /im 360safe.exe -f -t
taskkill /im popwin.exe -f -t
taskkill /im tip.exe -f -t
taskkill /im adctrl.exe -f -t
taskkill /im deviceassociation.exe -f -t
echo.
echo %GREEN%[√] 进程关闭完成%RESET%
echo.
echo %YELLOW%[2/9] 删除应用%RESET%
echo %CYAN%--------------------------------------------------------------%RESET%
echo.
powershell -Command "$list=@('*WindowsAlarms*','*WindowsSoundRecorder*','*WindowsCamera*','*Xbox*','*Bing*','*Maps*','*Clipchamp*','*StickyNotes*','*3DViewer*','*Todos*','*WindowsFeedbackHub*','*GetHelp*','*QuickAssist*','*MicrosoftSolitaireCollection*','*YourPhone*','*MicrosoftOfficeHub*','*OneNote*','*MicrosoftFamily*','*People*','*Teams*','*SkypeApp*','*OutlookForWindows*','*DevHome*');foreach($a in $list){Get-AppxPackage $a | Remove-AppxPackage -ErrorAction Ignore}"
echo.
echo %GREEN%[√] 应用卸载完成%RESET%
echo.
echo %YELLOW%[3/9] 更改启动项%RESET%
echo %CYAN%--------------------------------------------------------------%RESET%
echo.
sc config DiagTrack start= disabled
sc config WerSvc start= disabled
sc config Fax start= disabled
sc config RemoteRegistry start= disabled
sc config HomeGroupListener start= disabled
sc config HomeGroupProvider start= disabled
sc config XboxGipSvc start= disabled
sc config XblAuthManager start= disabled
sc config XblGameSave start= disabled
sc config XboxNetApiSvc start= disabled
echo.
echo %GREEN%[√] 服务配置完成%RESET%
echo.
echo %YELLOW%[4/9] 应用注册表%RESET%
echo %CYAN%--------------------------------------------------------------%RESET%
echo.
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\DataCollection" /v AllowTelemetry /t REG_DWORD /d 0 /f >nul
reg add "HKLM\SOFTWARE\Microsoft\Windows\ErrorReporting" /v Disabled /t REG_DWORD /d 1 /f >nul
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v HibernateEnabled /t REG_DWORD /d 0 /f >nul
powercfg /hibernate off >nul
echo.
echo %GREEN%[√] 注册表优化完成%RESET%
echo.
echo %YELLOW%[5/9] 垃圾清理%RESET%
echo %CYAN%--------------------------------------------------------------%RESET%
echo.
del /f /s /q "%tmp%\*" >nul 2>&1
del /f /s /q "%temp%\*" >nul 2>&1
del /f /s /q "C:\Windows\Temp\*" >nul 2>&1
del /f /s /q "C:\Windows\Prefetch\*" >nul 2>&1
rd /s /q "C:\$Recycle.Bin" >nul 2>&1
del /f /s /q "%LOCALAPPDATA%\Google\Chrome\User Data\Default\Cache\*" >nul 2>&1
del /f /s /q "%LOCALAPPDATA%\Microsoft\Edge\User Data\Default\Cache\*" >nul 2>&1
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 255 >nul 2>&1
for /r C:\ %%i in (*.log) do del /f /q "%%i" >nul 2>&1
echo.
echo %GREEN%[√] 垃圾清理完成%RESET%
echo.
echo %YELLOW%[6/9] 应用绿化%RESET%
echo %CYAN%--------------------------------------------------------------%RESET%
echo.
taskkill /f /im WeChat.exe WeChatUpdate.exe WeChatApp.exe >nul 2>&1
rd /s /q "%localappdata%\Tencent\WeChat\Update" >nul 2>&1
rd /s /q "%localappdata%\Tencent\WeChat\Ad" >nul 2>&1
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Run" /v WeChat /t REG_SZ /d "" /f >nul 2>&1
echo %GREEN%微信绿化完成%RESET%
taskkill /f /im QQ.exe QQProtect.exe QQUpdate.exe QQPet.exe >nul 2>&1
rd /s /q "%localappdata%\Tencent\QQ\Update" >nul 2>&1
rd /s /q "%localappdata%\Tencent\QQ\Ad" >nul 2>&1
reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Run" /v QQ /f >nul 2>&1
echo %GREEN%QQ绿化完成%RESET%
taskkill /f /im msedge.exe chrome.exe edgeupdate.exe googleupdate.exe >nul 2>&1
rd /s /q "%localappdata%\Microsoft\Edge\User Data\Default\Cache" >nul 2>&1
rd /s /q "%localappdata%\Google\Chrome\User Data\Default\Cache" >nul 2>&1
sc config edgeupdate start= disabled >nul 2>&1
sc config googleupdatesvc start= disabled >nul 2>&1
echo %GREEN%Edge/Chrome绿化完成%RESET%
taskkill /f /im wps.exe wpsoffice.exe WPSUpdater.exe wpsnotify.exe >nul 2>&1
taskkill /f /im WINWORD.EXE EXCEL.EXE POWERPNT.EXE XMind.exe >nul 2>&1
rd /s /q "%localappdata%\Kingsoft\WPS Office\update" >nul 2>&1
reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Run" /v WPSOffice /f >nul 2>&1
echo %GREEN%WPS绿化完成%RESET%
taskkill /f /im DingTalk.exe DingTalkUpdate.exe >nul 2>&1
rd /s /q "%localappdata%\DingTalk\Update" "%localappdata%\DingTalk\Cache" >nul 2>&1
reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Run" /v DingTalk /f >nul 2>&1
echo %GREEN%钉钉绿化完成%RESET%
taskkill /f /im SogouIME.exe QQIME.exe >nul 2>&1
rd /s /q "%localappdata%\Sogou\Input\Update" >nul 2>&1
rd /s /q "%localappdata%\Tencent\QQInput\Update" >nul 2>&1
reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Run" /v SogouPy /f >nul 2>&1
echo %GREEN%输入法绿化完成%RESET%
taskkill /f /im IDMan.exe qbittorrent.exe Bandizip.exe >nul 2>&1
rd /s /q "%appdata%\Bandisoft\Bandizip\Update" >nul 2>&1
rd /s /q "%appdata%\IDM\Update" >nul 2>&1
echo %GREEN%下载/压缩工具绿化完成%RESET%
taskkill /f /im Snipaste.exe Honeyview.exe PotPlayer.exe vlc.exe >nul 2>&1
rd /s /q "%localappdata%\Bandisoft\Honeyview\Update" >nul 2>&1
echo %GREEN%截图/播放器绿化完成%RESET%
taskkill /f /im Everything.exe Dism++.exe Geek.exe >nul 2>&1
rd /s /q "%appdata%\Everything\Update" >nul 2>&1
echo %GREEN%系统工具绿化完成%RESET%
taskkill /f /im SunloginClient.exe ToDesk.exe AnyDesk.exe >nul 2>&1
sc config ToDeskService start=disabled >nul 2>&1
sc config SunloginService start=disabled >nul 2>&1
echo %GREEN%远程工具绿化完成%RESET%
echo.
echo %GREEN%[√] 全部应用绿化完成%RESET%
echo.
echo %YELLOW%[7/9] Hosts 更改%RESET%
echo %CYAN%--------------------------------------------------------------%RESET%
echo.
set "hosts=C:\Windows\System32\drivers\etc\hosts"
(
echo.
echo :: 软件更新拦截
echo 0.0.0.0 update.qq.com
echo 0.0.0.0 update.weixin.qq.com
echo 0.0.0.0 wps-update.kingsoft.com
echo 0.0.0.0 edge.microsoft.com
echo 0.0.0.0 dl.google.com
echo 0.0.0.0 update.mozilla.org
echo 0.0.0.0 update.sogou.com
echo 0.0.0.0 update.qqinput.com
echo 0.0.0.0 update.todesk.com
echo 0.0.0.0 update.anydesk.com
echo 0.0.0.0 sunlogin.oray.com
echo 0.0.0.0 ad.doubleclick.net
echo 0.0.0.0 ad.qq.com
echo 0.0.0.0 ad.sogou.com
)>>"%hosts%"
ipconfig /flushdns >nul 2>&1
echo.
echo %GREEN%[√] Hosts 配置完成%RESET%
echo.
echo %YELLOW%[8/9] 禁用 Windows Defender%RESET%
echo %CYAN%--------------------------------------------------------------%RESET%
echo.
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows Defender" /v DisableAntiSpyware /t REG_DWORD /d 1 /f
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows Defender" /v DisableAntiVirus /t REG_DWORD /d 1 /f
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection" /v DisableRealtimeMonitoring /t REG_DWORD /d 1 /f
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows Defender Security Center" /v DisableSecurityCenter /t REG_DWORD /d 1 /f
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows Defender Security Center\Notifications" /v DisableNotifications /t REG_DWORD /d 1 /f
sc stop wuauserv >nul 2>&1
sc config wuauserv start= disabled >nul 2>&1
sc stop UsoSvc >nul 2>&1
sc config UsoSvc start= disabled >nul 2>&1
sc stop BITS >nul 2>&1
sc config BITS start= disabled >nul 2>&1
sc stop wscsvc >nul 2>&1
sc config wscsvc start= disabled >nul 2>&1
takeown /f "C:\Program Files\Windows Defender" /r /d y >nul 2>&1
icacls "C:\Program Files\Windows Defender" /grant *S-1-5-32-544:F /t /inheritance:r >nul 2>&1
rmdir /s /q "C:\Program Files\Windows Defender" >nul 2>&1
mkdir "C:\Program Files\Windows Defender" >nul 2>&1
icacls "C:\Program Files\Windows Defender" /inheritance:r >nul 2>&1
icacls "C:\Program Files\Windows Defender" /deny Everyone:F /t /c >nul 2>&1
takeown /f "C:\Program Files\Windows Defender Advanced Threat Protection" /r /d y >nul 2>&1
icacls "C:\Program Files\Windows Defender Advanced Threat Protection" /grant *S-1-5-32-544:F /t /inheritance:r >nul 2>&1
rmdir /s /q "C:\Program Files\Windows Defender Advanced Threat Protection" >nul 2>&1
mkdir "C:\Program Files\Windows Defender Advanced Threat Protection" >nul 2>&1
icacls "C:\Program Files\Windows Defender Advanced Threat Protection" /inheritance:r >nul 2>&1
icacls "C:\Program Files\Windows Defender Advanced Threat Protection" /deny Everyone:F /t /c >nul 2>&1
echo.
echo %GREEN%[√] Windows defender禁用成功%RESET%
echo.
echo %YELLOW%[9/9]Windows 设置%RESET%
echo %CYAN%--------------------------------------------------------------%RESET%
echo.
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\DataCollection" /v AllowTelemetry /t REG_DWORD /d 0 /f
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\DataCollection" /v DoNotShowFeedbackNotifications /t REG_DWORD /d 1 /f
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v DisableWindowsUpdateAccess /t REG_DWORD /d 1 /f
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v NoWindowsUpdate /t REG_DWORD /d 1 /f
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v NoAutoUpdate /t REG_DWORD /d 1 /f
sc stop securityhealthservice >nul 2>&1
sc config securityhealthservice start= disabled >nul 2>&1
sc stop DiagTrack >nul 2>&1
sc config DiagTrack start= disabled >nul 2>&1
echo.
echo %GREEN%[√] Windows 设置成功%RESET%
echo.
echo %PURPLE% 系统检测%RESET%
echo %CYAN%--------------------------------------------------------------%RESET%
echo.
echo %YELLOW%———— 检测服务情况 ————%RESET%
for %%s in (DiagTrack WerSvc Fax RemoteRegistry HomeGroupListener HomeGroupProvider XboxGipSvc XblAuthManager XblGameSave XboxNetApiSvc) do (
sc qc %%s | find "START_TYPE"
)
echo.
echo %YELLOW%———— 检测注册表情况 ————%RESET%
reg query "HKLM\SOFTWARE\Policies\Microsoft\Windows\DataCollection" /v AllowTelemetry >nul 2>nul && echo %GREEN%[OK] Telemetry Disabled%RESET%
reg query "HKLM\SOFTWARE\Microsoft\Windows\ErrorReporting" /v Disabled >nul 2>nul && echo %GREEN%[OK] Error Reporting Disabled%RESET%
reg query "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v HibernateEnabled >nul 2>nul && echo %GREEN%[OK] Hibernate Disabled%RESET%
echo.
echo %YELLOW%———— 重启桌面与窗口管理器 ————%RESET%
taskkill /f /im dwm.exe
start dwm.exe
taskkill /f /im explorer.exe
start explorer.exe
echo %GREEN%[OK] 桌面已重启%RESET%
echo.
echo %YELLOW%———— DISM 检测 ————%RESET%
echo [1/3] DISM快速检测
Dism /Online /Cleanup-Image /CheckHealth
echo.
echo [2/3] DISM深度检测
DISM /Online /Cleanup-Image /ScanHealth
if %errorlevel% equ 0 (
echo %GREEN%[3/3] 系统不存在故障%RESET%
) else (
echo %RED%[3/3] 系统存在故障,正在启动DISM修复...%RESET%
DISM /Online /Cleanup-Image /RestoreHealth
)
echo.
echo %YELLOW%———— SFC 系统文件检测 ————%RESET%
sfc /scannow
echo.
echo %YELLOW%———— 网络修复 ————%RESET%
ipconfig /release >nul 2>&1
ipconfig /renew >nul 2>&1
ipconfig /flushdns >nul 2>&1
netsh winsock reset >nul 2>&1
netsh int ip reset >nul 2>&1
echo %GREEN%[OK] 网络已重置%RESET%
echo.
echo %CYAN%==============================================================%RESET%
echo %GREEN% 全部操作完成!%RESET%
echo %CYAN%==============================================================%RESET%
echo.
pause
exit
恢复hosts.bat:
@echo off
fltmc >nul 2>&1 || (powershell start cmd -v runas /c ""%~f0"" &exit)
echo 恢复hosts程序
set "hosts=C:\Windows\System32\drivers\etc\hosts"
findstr /v ":: 软件更新拦截" "%hosts%" > "%hosts%.tmp"
move /y "%hosts%.tmp" "%hosts%" >nul 2>&1
ipconfig /flushdns >nul 2>&1
pause
exit
主要功能:
-
关闭无效进程
-
删除无效应用
-
更改无效启动项
-
更改臃肿注册表
-
垃圾清理
-
常用应用绿化
-
Hosts清理广告
-
禁用WD
-
优化设置
-
系统修复
非常好用,我的核显i3都可以流畅运行 (当然打不了3A)
谨慎运行,会导致有一些系统功能被禁用!(可以正常办公)
全部评论 2
我怎么看不懂
1周前 来自 浙江
0有中文注释啊
1周前 来自 湖南
0精简的主要就是杀进程、删除启动项、禁用服务和删除文件
修复的主要就是系统扫描、快速重启系统1周前 来自 湖南
0



1周前 来自 浙江
0




















有帮助,赞一个