@echo off cls color 17 :main cls echo --------Window7优化批处理---------- echo. echo 1 - 一键优化 echo 2 - 优化服务 echo 3 - 清理垃圾 echo 4 - 优化注册表 echo 5 - 关闭默认共享 echo 6 - 关闭135,139,445,593,1025,23,21,25,137,138,20168,1024,3389,1029端口 echo 0 - 退出 echo by 风林火山 echo ----------------------------------- echo 请输入【序列号 + 回车】: set rmain=1 set /p input= if %input%==1 goto a else goto main if %input%==2 goto b else goto main if %input%==3 goto c else goto main if %input%==4 goto d else goto main if %input%==5 goto e else goto main if %input%==6 goto f else goto main if %input%==0 exit goto main :a set dd=b c d e f set rmain=0 for %%a in (%dd%) do (goto %%a) goto main :b echo 开始优化win7服务项... @echo on sc config AxInstSV start= demand sc config SensrSvc start= disabled sc config AeLookupSvc start= disabled sc config AppIDSvc start= demand sc config Appinof start= demand sc config ALG start= disabled sc config AppMgmt start= disabled sc config BITS start= demand sc config BFE start= auto sc config BDESVC start= disabled sc config wbengine start= disabled sc config bthserv start= disabled sc config peerdistsvc start= disabled sc config certpropsvc start= disabled sc config keyiso start= demand sc config eventsystem start= auto sc config comsysapp start= demand sc config browser start= demand sc config vaultsvc start= dsiabled sc config cryptsvc start= auto sc config dcomlaunch start= auto sc config uxsms start= auto sc config dhcp start= auto sc config dps start= disabled sc config wdiservicehost start= disabled sc config wdisystemhost start= disabled sc config defragsvc start= demand sc config trkwks start= disabled sc config msdtc start= demand sc config dnscashe start= auto sc config efs start= disabled sc config eaphost start= demand sc config fax start= disabled sc config fdphost start= disabled sc config fdrespub start= disabled sc config gpsvc start= auto sc config hkmsvc start= disabled sc config homegrouplistener start= disabled sc config homegroupprovider start= disabled sc config hidserv start= disabled sc config ikeext start= demand sc config ui0detect start= disabled sc config sharedaccess start= disabled sc config iphlpsvc start= disabled sc config policyagent start= auto sc config ktmrm start= demand sc config lltdsvc start= disabled sc config mcx2svc start= disabled sc config clr_optimization_v2.0.50727_32 start= demand sc config clr_optimization_v4.0.30319_32 start= auto sc config swprv start= demand sc config mmcss start= auto sc config nettcpportsharing start= disabled sc config netlogon start= disabled sc config napagent start= disabled sc config netman start= demand sc config netprofm start= demand sc config nlasvc start= auto sc config nsi start= auto sc config cscservice start= disabled sc config wpcsvc start= disabled sc config pnrpsvc start= disabled sc config p2psvc start= disabled sc config p2pimsvc start= disabled sc config pla start= demand sc config plugplay start= auto sc config ipbusenum start= disabled sc config pnrpautoreg start= disabled sc config wpdbusenum start= disabled sc config power start= auto sc config spooler start= auto sc config wercplsupport start= disabled sc config pcasvc start= disabled sc config protectedstorage start= demand sc config qwave start= disabled sc config rasauto start= demand sc config rasman start= demand sc config sessionenv start= disabled sc config termservice start= disabled sc config umrdpservice start= disabled sc config rpcss start= disabled sc config rpclocator start= disabled sc config remoteregistry start= disabled sc config remoteaccess start= disabled sc config rpceptmapper start= auto sc config seclogon start= demand sc config sstpsvc start= demand sc config samss start= auto sc config wscsvc start= delayed-auto sc config lanmanserver start= auto sc config shellhwdetection start= auto sc config scardsvr start= disabled sc config scpolicysvc start= disabled sc config snmptrap start= disabled sc config sppsvc start= delayed-auto sc config sppuinotify start= demand sc config ssdpsrv start= demand sc config storsvc start= demand sc config sysmain start= auto sc config sens start= auto sc config tabletinputservice start= disabled sc config schedule start= auto sc config lmhosts start= auto sc config tapisrv start= demand sc config themes start= auto sc config threadorder start= demand sc config tbs start= demand sc config upnphost start= demand sc config profsvc start= auto sc config vds start= demand sc config vss start= demand sc config webclient start= disabled sc config audiosrv start= auto sc config audioendpointbuilder start= auto sc config sdrsvc start= demand sc config wbiosrvc start= disabled sc config idsvc start= disabled sc config wcspluginservice start= disabled sc config windefend start= disabled sc config wudfsvc start= demand sc config wersvc start= disabled sc config wecsvc start= demand sc config eventlog start= auto sc config mpssvc start= auto sc config fontcache start= demand sc config stisvc start= auto sc config msiserver start= demand sc config winmgmt start= auto sc config ehrecvr start= disabled sc config ehsched start= disabled sc config wmpnetworksvc start= disabled sc config trustedinstaller start= demand sc config fontcache3.0.0.0 start= demand sc config winrm start= disabled sc config wsearch start= disabled sc config w32time start= demand sc config wuauserv start= delayed-auto sc config winhttpautoproxysvc start= disabled sc config dot3svc start= demand sc config wlansvc start= demand sc config wmiapsrv start= demand sc config lanmanworkstation start= auto sc config wwansvc start= demand echo win7服务项优化完成! @echo off if %rmain%==1 goto main :c echo 正在清除系统垃圾文件,请稍等...... del /f /s /q %systemdrive%\*.tmp 2>nul del /f /s /q %systemdrive%\*._mp 2>nul del /f /s /q %systemdrive%\*.log 2>nul del /f /s /q %systemdrive%\*.gid 2>nul del /f /s /q %systemdrive%\*.chk 2>nul del /f /s /q %systemdrive%\*.old 2>nul del /f /s /q %windir%\*.bak 2>nul rd /s /q %windir%\temp & md %windir%\temp 2>nul cacls %windir%\temp /t /g administrators:f system:f del /f /q %userprofile%\cookies\*.* 2>nul del /f /s /q %userprofile%\recent\*.* 2>nul del /f /s /q "%userprofile%\Local Settings\Temporary Internet Files\*.*" 2>nul rd /s /q %userprofile%\Local Settings\Temp & md %userprofile%\Local Settings\Temp 2>nul cacls %userprofile%\Local Settings\Temp /t /g administrators:f system:f echo 清除系统垃圾完成! echo 开始清理其他盘的垃圾... set str=d e f g h i j k l m n o p q r s t u v w x y z for %%a in (%str%) do (%%a: del /f /s /q *.log del /f /s /q *.tmp del /f /s /q thumbs.db) echo 清理其他盘的垃圾完成! if %rmain%==1 goto main :d echo 开始优化注册表... echo 禁用远程协助 set pp="HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" reg add %pp% /v fAllowToGetHelp /t REG_DWORD /d 0 /f>nul reg add %pp% /v DeleteTempDirsOnExit /t REG_DWORD /d 1 /f>nul echo 禁用系统还原 set pp="HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SystemRestore" reg add %pp% /v DisableSR /t REG_DWORD /d 1 /f>nul echo 关闭休眠 set pp="HKLM\SYSTEM\ControlSet001\Control\Power" reg add %pp% /v HibernateEnable /t REG_DWORD /d 0 /f>nul echo 添加记事本打开右键菜单选项 set pp="HKCR\*\shell\用记事本打开" reg add %pp% set pp="HKCR\*\shell\用记事本打开\command" reg add %pp% reg add %pp% /v (默认) /t REG_SZ /d "notepad %1" /f>nul echo 禁止光盘和U盘自动运行 set pp="HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" reg add %pp% /v NoDriveTypeAutoRun /t REG_DWORD /d 255 /f>nul set pp="HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" reg add %pp% /v NoDriveTypeAutoRun /t REG_DWORD /d 255 /f>nul set pp="HKLM\SYSTEM\ControlSet001\Services\cdrom" reg add %pp% /v Autorun /t REG_DWORD /d 0 /f>nul set pp="HKLM\SYSTEM\CurrentControlSet\Services\cdrom" reg add %pp% /v Autorun /t REG_DWORD /d 0 /f>nul echo 添加CMD右键菜单 set pp="HKLM\SOFTWARE\Classes\Folder\shell\cmd" reg add %pp% set pp="HKLM\SOFTWARE\Classes\Folder\shell\cmd\command" reg add %pp% reg add %pp% /v (默认) /t REG_SZ /d "cmd.exe /k cd %1" /f>nul echo 开启TCP/IP半开连接限制 set pp="HKLM\CurrentControlSet\Services\Tcpip\Parameters" reg add %pp% /v EnableConnectionRateLimiting /t REG_DWORD /d 0 /f>nul echo 显示文件扩展名 set pp="HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" reg add %pp% /v HideFileExt /t REG_DWORD /d 0 /f>nul echo 优化注册表完毕! if %rmain%==1 goto main :e echo 开始关闭默认共享... net share ipc$ /del for %%a in (%str%) do (net share %%a$ /del) echo 关闭默认共享成功! if %rmain%==1 goto main :f echo 开始关闭端口... netsh ipsec static add filteraction name=阻止 action=block netsh ipsec static add policy name=默认策略 netsh ipsec static add filterlist name=默认过滤 netsh ipsec static add filter filterlist=默认过滤 srcaddr=any dstaddr=me dstport=135 protocol=tcp mirrored=yes netsh ipsec static add filter filterlist=默认过滤 srcaddr=any dstaddr=me dstport=135 protocol=udp mirrored=yes netsh ipsec static add filter filterlist=默认过滤 srcaddr=any dstaddr=me dstport=139 protocol=tcp mirrored=yes netsh ipsec static add filter filterlist=默认过滤 srcaddr=any dstaddr=me dstport=139 protocol=udp mirrored=yes netsh ipsec static add filter filterlist=默认过滤 srcaddr=any dstaddr=me dstport=445 protocol=tcp mirrored=yes netsh ipsec static add filter filterlist=默认过滤 srcaddr=any dstaddr=me dstport=445 protocol=udp mirrored=yes netsh ipsec static add filter filterlist=默认过滤 srcaddr=any dstaddr=me dstport=593 protocol=tcp mirrored=yes netsh ipsec static add filter filterlist=默认过滤 srcaddr=any dstaddr=me dstport=593 protocol=udp mirrored=yes netsh ipsec static add filter filterlist=默认过滤 srcaddr=any dstaddr=me dstport=1025 protocol=tcp mirrored=yes netsh ipsec static add filter filterlist=默认过滤 srcaddr=any dstaddr=me dstport=1025 protocol=udp mirrored=yes netsh ipsec static add filter filterlist=默认过滤 srcaddr=any dstaddr=me dstport=3389 protocol=tcp mirrored=yes netsh ipsec static add filter filterlist=默认过滤 srcaddr=any dstaddr=me dstport=3389 protocol=udp mirrored=yes netsh ipsec static add filter filterlist=默认过滤 srcaddr=any dstaddr=me dstport=1024 protocol=tcp mirrored=yes netsh ipsec static add filter filterlist=默认过滤 srcaddr=any dstaddr=me dstport=1024 protocol=udp mirrored=yes netsh ipsec static add filter filterlist=默认过滤 srcaddr=any dstaddr=me dstport=20168 protocol=tcp mirrored=yes netsh ipsec static add filter filterlist=默认过滤 srcaddr=any dstaddr=me dstport=20168 protocol=udp mirrored=yes netsh ipsec static add filter filterlist=默认过滤 srcaddr=any dstaddr=me dstport=1029 protocol=tcp mirrored=yes netsh ipsec static add filter filterlist=默认过滤 srcaddr=any dstaddr=me dstport=1029 protocol=udp mirrored=yes netsh ipsec static add filter filterlist=默认过滤 srcaddr=any dstaddr=me dstport=23 protocol=tcp mirrored=yes netsh ipsec static add filter filterlist=默认过滤 srcaddr=any dstaddr=me dstport=23 protocol=udp mirrored=yes netsh ipsec static add filter filterlist=默认过滤 srcaddr=any dstaddr=me dstport=21 protocol=tcp mirrored=yes netsh ipsec static add filter filterlist=默认过滤 srcaddr=any dstaddr=me dstport=21 protocol=udp mirrored=yes netsh ipsec static add filter filterlist=默认过滤 srcaddr=any dstaddr=me dstport=137 protocol=tcp mirrored=yes netsh ipsec static add filter filterlist=默认过滤 srcaddr=any dstaddr=me dstport=137 protocol=udp mirrored=yes netsh ipsec static add filter filterlist=默认过滤 srcaddr=any dstaddr=me dstport=138 protocol=tcp mirrored=yes netsh ipsec static add filter filterlist=默认过滤 srcaddr=any dstaddr=me dstport=138 protocol=udp mirrored=yes netsh ipsec static add filter filterlist=默认过滤 srcaddr=any dstaddr=me dstport=25 protocol=tcp mirrored=yes netsh ipsec static add filter filterlist=默认过滤 srcaddr=any dstaddr=me dstport=25 protocol=udp mirrored=yes netsh ipsec static add rule name=kill policy=默认策略 filterlist=默认过滤 filteraction=阻止 netsh ipsec static set policy name=默认策略 assign=y echo 关闭端口完毕 if %rmain%==1 goto main
时间: 2024-10-08 19:41:00