From a597f2a7d16aaf74f94525fd133adeb23cb2eb2a Mon Sep 17 00:00:00 2001 From: Elivo Date: Sun, 3 Oct 2021 18:44:53 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=96=87=E4=BB=B6=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F=EF=BC=8C=E6=94=AF=E6=8C=81=20UTF-8=20=E6=96=87?= =?UTF-8?q?=E6=9C=AC=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Optimizer - Win 10.cmd | 305 ++++++++++++++++++++++------------------- 1 file changed, 163 insertions(+), 142 deletions(-) diff --git a/Optimizer - Win 10.cmd b/Optimizer - Win 10.cmd index ac0f37c..b490488 100644 --- a/Optimizer - Win 10.cmd +++ b/Optimizer - Win 10.cmd @@ -1,10 +1,43 @@ @echo off -title Optimizer - Win 10 +chcp 65001 +mode con lines=40 +title Optimizer - Win 10 - 2021-05-18 + cls echo. -echo Version: 2021-05-18 -echo ________________________________________________________________________________________________________________________ +echo 性能优化 +echo - 禁用 Windows 自带垃圾服务 +echo - 禁用一些软件的垃圾服务 +echo - 禁用页面文件 +echo - 禁用应用程序预读 +echo - 减少应用程序响应超时 +echo - 自动卸载 DLL +echo - 删除垃圾开机启动项 +echo - 禁用 Windows 更新的 7GB 保留空间 +echo. +echo 安全性 + +echo - 允许设置自动登录 +echo - 允许使用 HTTP 连接 WebDAV 站点 +echo - 禁用 IPSec 以允许使用预共享密钥的 L2TP 连接 +echo - 禁用 CD-ROM 自动运行 +echo. +echo 个性化 +echo - 使用 pool.ntp.org 作为 NTP 客户端同步的地址 +echo - 禁用关机原因 +echo - 禁用登录前的 CTRL + ALT + DELETE +echo - 禁用休眠 +echo - 桌面壁纸使用最高质量 + +echo - 禁用快捷方式后缀 +echo - 删除资源管理器中的 3D 对象 +echo - 禁用 thumbs.db 文件 +echo. + +rem ================================================================================ + +rem 检查管理员身份 rem check UAC set uac="%temp%\uac.vbs" @@ -13,136 +46,89 @@ if '%errorlevel%' NEQ '0' ( goto uac ) else ( if exist %uac% del %uac% + rem echo 按任意键开始执行优化。 + rem pause > nul goto run ) :uac +echo. +echo 修改系统设置需要管理员身份。 echo Set UAC = CreateObject^("Shell.Application"^) > %uac% echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> %uac% %uac% exit /b :run -rem echo. -rem echo Press any key to start optimizing process. -rem pause > nul -rem echo. +echo. -echo Service: Application Layer Gateway Service -sc config alg start= auto >nul +rem ================================================================================ +rem 性能优化 + +rem 禁用 Windows 自带垃圾服务 +rem Service: Application Layer Gateway Service +sc config alg start= disabled >nul rem echo Service: AVCTP rem sc config bthavctpsvc start= disabled >nul - -echo Service: Computer Browser +rem Service: Computer Browser sc config browser start= auto >nul - -echo Service: Certificate Propagation +rem Service: Certificate Propagation sc config certpropsvc start= disabled >nul - -echo Service: Connected User Experiences and Telemetry +rem Service: Connected User Experiences and Telemetry sc config diagtrack start= disabled >nul - -echo Service: Debugging Helper +rem Service: Debugging Helper sc config debugregsvc start= disabled >nul - -echo Service: Diagnostic Execution Service +rem Service: Diagnostic Execution Service sc config diagsvc start= disabled >nul - -echo Service: Diagnostic Policy Service +rem Service: Diagnostic Policy Service sc config dps start= disabled >nul - -echo Service: Diagnostic Service Host +rem Service: Diagnostic Service Host sc config wdiservicehost start= disabled >nul - -echo Service: Diagnostic System Host +rem Service: Diagnostic System Host sc config wdisystemhost start= disabled >nul - -echo Service: Distributed Transaction Coordinator +rem Service: Distributed Transaction Coordinator sc config msdtc start= disabled >nul - -echo Service: Encrypting File System +rem Service: Encrypting File System sc config efs start= disabled >nul - -echo Service: Geolocation Service +rem Service: Geolocation Service sc config lfsvc start= disabled >nul - -echo Service: HomeGroup Listener +rem Service: HomeGroup Listener sc config homegrouplistener start= disabled >nul - -echo Service: HomeGroup Provider +rem Service: HomeGroup Provider sc config homegroupprovider start= disabled >nul - -echo Service: Internet Connection Sharing (ICS) +rem Service: Internet Connection Sharing (ICS) sc config sharedaccess start= disabled >nul - -echo Service: Offline Files +rem Service: Offline Files sc config cscservice start= disabled >nul - -echo Service: Portable Device Enumerator Service +rem Service: Portable Device Enumerator Service sc config wpdbusenum start= disabled >nul - -echo Service: Problem Reports and Solutions Control Panel Support +rem Service: Problem Reports and Solutions Control Panel Support sc config wercplsupport start= disabled >nul - -echo Service: Program Compatibility Assistant Service +rem Service: Program Compatibility Assistant Service sc config pcasvc start= disabled >nul - -echo Service: Quality Windows Audio Video Experience +rem Service: Quality Windows Audio Video Experience sc config qwave start= disabled >nul - -echo Service: SSDP Discovery +rem Service: SSDP Discovery sc config ssdpsrv start= disabled >nul - -echo Service: Superfetch +rem Service: Superfetch sc config sysmain start= disabled >nul - -echo Service: Themes +rem Service: Themes sc config themes start= disabled >nul - -echo Service: Windows Error Reporting Service +rem Service: Windows Error Reporting Service sc config wersvc start= disabled >nul - -echo Service: Windows Search +rem Service: Windows Search sc config wsearch start= disabled >nul - -echo Service: WMI Performance Adapter +rem Service: WMI Performance Adapter sc config wmiApSrv start= disabled >nul -echo Service: Windows Time -set vk="HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Config" -reg add %vk% /v "AnnounceFlags" /t reg_dword /d 5 /f >nul -set vk="HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpServer" -reg add %vk% /v "Enabled" /t reg_dword /d 1 /f >nul -set vk="HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpClient" -reg add %vk% /v "SpecialPollInterval" /t reg_dword /d 60 /f >nul -set vk="HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Parameters" -reg add %vk% /v "NtpServer" /t reg_sz /d "pool.ntp.org" /f >nul -sc config w32time start= auto >nul -sc stop w32time >nul -sc start w32time >nul - -echo Service: WebDAV -set vk="HKLM\SYSTEM\CurrentControlSet\Services\WebClient\Parameters" -reg add %vk% /v "BasicAuthLevel" /t REG_DWORD /d 2 /f >nul -reg add %vk% /v "FileSizeLimitInBytes" /t REG_DWORD /d 4294967295 /f >nul -sc config WebClient start= demand >nul -sc stop WebClient >nul -sc start WebClient >nul - -echo Service: L2TP -set vk="hklm\system\currentcontrolset\services\rasman\parameters" -reg add %vk% /v "ProhibitIPSec" /t reg_dword /d 0 /f >nul -set vk="hklm\system\currentcontrolset\services\policyagent" -reg add %vk% /v "AssumeUDPEncapsulationContextOnSendRule" /t reg_dword /d 2 /f >nul - -echo Application: Adobe Service +rem 禁用 Adobe 垃圾服务 sc config agsservice start= disabled >nul sc config adobeupdateservice start= disabled >nul -echo Application: Adobe iTunes +rem 禁用 iTunes 垃圾服务 sc config ipxlatcfgsvc start= disabled >nul -echo Application: Intel +rem 禁用 Intel 垃圾服务 sc config cplspcon start= disabled >nul sc config cphs start= disabled >nul sc config esifsvc start= disabled >nul @@ -152,36 +138,36 @@ sc config jhi_service start= disabled >nul sc config "Intel(R) Capability Licensing Service TCP IP Interface" start= disabled >nul sc config "Intel(R) TPM Provisioning Service" start= disabled >nul -echo Application: NVIDIA Display Container +rem 禁用 NVIDIA 垃圾服务 sc config nvcontainerlocalsystem start= disabled >nul sc config nvcontainernetworkservice start= disabled >nul sc config nvdisplay.containerlocalsystem start= disabled >nul sc config nvtelemetrycontainer start= disabled >nul -echo Application: AMD Graphics +rem 禁用 AMD 垃圾服务 sc config "AMD External Events Utility" start= disabled >nul regsvr32 /u /s atiacmxx.dll >nul rem set vk="hkcr\directory\background\shellex\ace" rem reg delete %vk% /f >nul -echo Application: VMware Tools +rem 禁用 VMware 垃圾服务 sc config tpautoconnsvc start= disabled >nul sc config vmvss start= disabled >nul sc config vgauthservice start= disabled >nul sc config "vmware physical disk helper service" start= disabled >nul -echo Performance: Page File +rem 禁用页面文件 set vk="hklm\system\currentcontrolset\control\session manager\memory management" reg add %vk% /v "pagingfiles" /t reg_multi_sz /d "" /f >nul reg add %vk% /v "disablepagingexecutive" /t reg_dword /d 1 /f >nul rem reg add %vk% /v "clearpagefileatshutdown" /t reg_dword /d 1 /f >nul -echo Performance: Prefetch +rem 禁用应用程序预读 set vk="hklm\system\currentcontrolset\control\session manager\memory management\prefetchparameters" reg add %vk% /v "enableprefetcher" /t reg_dword /d 1 /f >nul reg add %vk% /v "enablesuprefetcher" /t reg_dword /d 3 /f >nul -echo Performance: Application Response +rem 减少应用程序响应超时 set vk="hklm\system\currentcontrolset\control\windows" reg add %vk% /v "nopopupsonboot" /t reg_dword /d 1 /f >nul set vk="hklm\system\currentcontrolset\control" @@ -195,83 +181,118 @@ reg add %vk% /v "autoendtasks" /t reg_sz /d "1" /f >nul reg add %vk% /v "hungapptimeout" /t reg_sz /d "500" /f >nul reg add %vk% /v "waittokillapptimeout" /t reg_sz /d "1000" /f >nul -echo Security: Auto Run -set vk="hklm\system\currentcontrolset\services\cdrom" -reg add %vk% /v "autorun" /t reg_dword /d 0 /f >nul +rem 自动卸载 DLL +set vk="hklm\software\microsoft\windows\currentversion\explorer" +reg add %vk% /v "alwaysunloaddll" /t reg_dword /d 1 /f >nul -echo Security: Enable AutoLogin +rem 删除垃圾开机启动项 +set vk="hklm\software\microsoft\windows\currentversion\run" +reg delete %vk% /v "hotkeyscmds" /f >nul +reg delete %vk% /v "igfxtray" /f >nul +reg delete %vk% /v "persistence" /f >nul +reg delete %vk% /v "rthdcpl" /f >nul +reg delete %vk% /v "adobeaamupdater-1.0" /f >nul +reg delete %vk% /v "windowsdefender" /f >nul +set vk="hklm\software\wow6432node\microsoft\windows\currentversion\run" +reg delete %vk% /v "vmware-tray.exe" /f >nul +reg delete %vk% /v "adskappmanager" /f >nul +reg delete %vk% /v "adobe arm" /f >nul + +rem 禁用 Windows 更新的 7GB 保留空间 +set vk="hklm\software\microsoft\windows\currentversion\reservemanager" +reg add %vk% /v "shippedwithreserves" /t reg_dword /d 0 /f >nul + +rem ================================================================================ + +rem 安全性 + +rem 允许设置自动登录 set vk="hklm\Software\Microsoft\Windows NT\CurrentVersion\PasswordLess\Device" reg add %vk% /v "DevicePasswordLessBuildVersion" /t reg_dword /d 0 /f >nul -echo Security: WebDAV -set vk="hklm\SYSTEM\CurrentControlSet\Services\WebClient\Parameters" -reg add %vk% /v "BasicAuthLevel" /t reg_dword /d 2 /f >nul +rem 允许使用 HTTP 连接 WebDAV 站点 +set vk="HKLM\SYSTEM\CurrentControlSet\Services\WebClient\Parameters" +reg add %vk% /v "BasicAuthLevel" /t REG_DWORD /d 2 /f >nul +reg add %vk% /v "FileSizeLimitInBytes" /t REG_DWORD /d 4294967295 /f >nul +sc config WebClient start= demand >nul +sc stop WebClient >nul +sc start WebClient >nul + +rem 禁用 IPSec 以允许使用预共享密钥的 L2TP 连接 +set vk="hklm\system\currentcontrolset\services\rasman\parameters" +reg add %vk% /v "ProhibitIPSec" /t reg_dword /d 0 /f >nul +set vk="hklm\system\currentcontrolset\services\policyagent" +reg add %vk% /v "AssumeUDPEncapsulationContextOnSendRule" /t reg_dword /d 2 /f >nul + +rem 禁用 CD-ROM 自动运行 +set vk="hklm\system\currentcontrolset\services\cdrom" +reg add %vk% /v "autorun" /t reg_dword /d 0 /f >nul + +rem ================================================================================ + +rem 个性化 + +rem 使用 pool.ntp.org 作为 NTP 客户端同步的地址 +echo Service: Windows Time +set vk="HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Config" +reg add %vk% /v "AnnounceFlags" /t reg_dword /d 5 /f >nul +set vk="HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpServer" +reg add %vk% /v "Enabled" /t reg_dword /d 1 /f >nul +set vk="HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpClient" +reg add %vk% /v "SpecialPollInterval" /t reg_dword /d 60 /f >nul +set vk="HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Parameters" +reg add %vk% /v "NtpServer" /t reg_sz /d "pool.ntp.org" /f >nul +sc config w32time start= auto >nul +sc stop w32time >nul +sc start w32time >nul +rem 禁用关机原因 echo Personalized: Easily Operation set vk="hklm\software\policies\microsoft\windows nt\reliability" reg add %vk% /v "shutdownreasonon" /t reg_dword /d 1 /f >nul + +rem 禁用登录前的 CTRL + ALT + DELETE set vk="hklm\software\microsoft\windows\currentversion\policies\system" reg add %vk% /v "disablecad" /t reg_dword /d 1 /f >nul -echo Personalized: Power +rem 禁用休眠 powercfg -h off >nul + +rem 启用卓越性能 rem powercfg -duplicatescheme e9a42b02-d5df-448d-aa00-03f14749eb61 -set vk="HKLM\SYSTEM\CurrentControlSet\Control\Power\PowerSettings\7516b95f-f776-4464-8c53-06167f40cc99\8EC4B3A5-6868-48c2-BE75-4F3044BE88A7" -reg add %vk% /v "Attributes" /t reg_dword /d 2 /f >nul -echo Personalized: Desktop +rem 禁用锁频后自动熄屏 +rem set vk="HKLM\SYSTEM\CurrentControlSet\Control\Power\PowerSettings\7516b95f-f776-4464-8c53-06167f40cc99\8EC4B3A5-6868-48c2-BE75-4F3044BE88A7" +rem reg add %vk% /v "Attributes" /t reg_dword /d 2 /f >nul + +rem 桌面壁纸使用最高质量 set vk="hkcu\control panel\desktop" reg add %vk% /v "jpegimportquality" /t reg_dword /d 100 /f >nul -set vk="hkcu\software\microsoft\windows\currentversion\explorer" -reg add %vk% /v "link" /t reg_dword /d 0 /f >nul set vk="hku\.default\control panel\desktop" reg add %vk% /v "jpegimportquality" /t reg_dword /d 100 /f >nul -set vk="hku\.default\software\microsoft\windows\currentversion\explorer" -reg add %vk% /v "link" /t reg_dword /d 0 /f >nul -echo Personalized: Short Cut +rem 禁用快捷方式后缀 set vk="hkcu\software\microsoft\windows\currentversion\explorer" reg add %vk% /v "link" /t reg_dword /d 0 /f >nul set vk="hku\.default\software\microsoft\windows\currentversion\explorer" reg add %vk% /v "link" /t reg_dword /d 0 /f >nul -echo Personalized: Remove 3D Objects +rem 删除资源管理器中的 3D 对象 set vk="hklm\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}" reg delete %vk% /f >nul -rem echo Personalized: Log In Keyboard -rem set vk="hku\.default\control pannel\keyboard" -rem reg add %vk% /v "initialkeyboardindicators" /t reg_sz /d "80000002" /f >nul - -echo Clean: Dynamic Link Library -set vk="hklm\software\microsoft\windows\currentversion\explorer" -reg add %vk% /v "alwaysunloaddll" /t reg_dword /d 1 /f >nul +rem 禁用 thumbs.db 文件 +set vk="HKLM\SOFTWARE\Policies\Microsoft\Windows\Explorer" +reg add %vk% /v "DisableThumbsDBOnNetworkFolders" /t reg_dword /d 1 /f >nul -echo Clean: Autoruns -set vk="hklm\software\microsoft\windows\currentversion\run" -reg delete %vk% /v "hotkeyscmds" /f >nul -reg delete %vk% /v "igfxtray" /f >nul -reg delete %vk% /v "persistence" /f >nul -reg delete %vk% /v "rthdcpl" /f >nul -reg delete %vk% /v "adobeaamupdater-1.0" /f >nul -reg delete %vk% /v "windowsdefender" /f >nul -set vk="hklm\software\wow6432node\microsoft\windows\currentversion\run" -reg delete %vk% /v "vmware-tray.exe" /f >nul -reg delete %vk% /v "adskappmanager" /f >nul -reg delete %vk% /v "adobe arm" /f >nul +rem 启用数字键区 +rem set vk="hku\.default\control pannel\keyboard" +rem reg add %vk% /v "InitialKeyboardIndicators" /t reg_sz /d "80000002" /f >nul -echo Clean: Windows Update Reserved 7GB -set vk="hklm\software\microsoft\windows\currentversion\reservemanager" -reg add %vk% /v "shippedwithreserves" /t reg_dword /d 0 /f >nul +rem ================================================================================ -echo ________________________________________________________________________________________________________________________ echo. - echo The optimizing operation had been completed. -pause >nul - -rem echo The optimizing operation had been completed. Press any key to reboot. -rem pause >nul -rem start /min shutdown -r -t 0 +echo 优化已完成,部分优化项在重启后生效。 -:end \ No newline at end of file +:end