清理系统垃圾及优化网络 批处理命令代码.doc_第1页
清理系统垃圾及优化网络 批处理命令代码.doc_第2页
清理系统垃圾及优化网络 批处理命令代码.doc_第3页
清理系统垃圾及优化网络 批处理命令代码.doc_第4页
清理系统垃圾及优化网络 批处理命令代码.doc_第5页
已阅读5页,还剩30页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

把下面代码复制到记事本中,然后改后缀为 .dat 如然后打开点能运行运行效果如图下面代码 一直到最后 echo offclsrem rem Contact: url= /urlremrem This program is free software; you can redistribute it and/or modify it underrem the terms of the GNU General Public License as published by the Free Software Foundation;rem either version 2 of the License, or (at your option) any later version.rem This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;rem without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.rem See the GNU General Public License for more details.remrem You should have received a copy of the GNU General Public License along with this program;rem if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,rem MA 02111-1307, USA.echo.REM Tested on . WinXP_SP2REM Always basic XP64 SupportREM Modifications to BITS service (cause of v5 WindowsUpdate) - #discharged#REM Additional notices corresponding to DHCP issueREM Variables problems during RESTORE_DEFAULT usage fixedREM SMBDEVICEENABLED Restore Bug fixedREM Mod_history-09-27-2005*11-08-2005*11-29-2005*12-07-2005*12-18-2005setlocalREM * INIT_VARS *set CHK_SVC=YESset XPSP2=FALSEset SERVER=FALSEset NT_SERVER_CHK=TRUE:STARTecho svc2kXp.cmd 正在检测您的电脑,稍后进行优化! echo =set find=%SystemRoot%System32find.exeset regedit=%SystemRoot%regedit.exeif not exist %find% goto :NOFINDif not exist %regedit% goto :NOREGEDITif not %1 = %* goto :SYNTAXif /I %1=/? goto :HELPif /I %1=/help goto :HELPif /I %1=-h goto :HELPif /I %1=-help goto :HELPif /I %1=-? goto :HELPif /I %1=-? goto :HELPif /I %1=/fix goto :FIXgoto :VERSION:SYNTAXecho.echo.echo !Syntax error!echo _echo Es kann nur ein oder kein Parameter angegeben werden.echo.echo Only one or no parameter allowed.goto :QUIT:HELPecho.echo -= Hilfe =-echo Parameter:echo /lan.Einige Dienste fuer LAN-Betrieb werden nicht veraendert.echo /std.Schliesst alle Ports, einige Dienste bleiben unveraendert.echo /all.Setzt alle Vorschlaege nach www.ntsvcfg.de um (hardening).echo /restore.Nimmt die zuletzt vorgenommenen Aenderungen zurueck.echo /reLAN.Reaktiviert Dienste, die fuer LAN-Betrieb benoetigt werden.echo /default.Setzt alle Diensteinstellungen auf urspr黱gliche Werte zur點k.echo.echo Parameters:echo /lan.Some services needed for LAN-usage stay unchanged!echo /std.Closes all Ports, but some services stay unchangedecho /all.Changes all issues recommended by www.ntsvcfg.de (hardening)echo /restore.Undo last changes.echo /reLAN.Reactivates services required for LAN.echo /default.Restoring factory service settings (before first time usage)echo.echo example: svc2kxp.cmd /allecho.set /P CHS= Press G for GNU GPL informations or Q for quit?if /I %CHS%=G goto :GNU_GPLif /I %CHS%=Q goto :QUIT_EXTCLSgoto :HELP:GNU_GPLCLSecho Informations about GNU-General Public License for svc2kxp.cmdecho =echo.echo Copyright (C) 2003-05 Ansgar Wiechers, Torsten Mannecho Contact: url=mailto:adminntsvcfg.deadminntsvcfg.de/urlecho.echo This program is free software; you can redistribute it and/or modify it underecho the terms of the GNU General Public License as published by the Free Softwareecho Foundation; either version 2 of the License, or (at your option) any laterecho version. This program is distributed in the hope that it will be useful, butecho WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY orecho FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for moreecho details.echo.echo You should have received a copy of the GNU General Public License along withecho this program; if not, write to the:echo.echo Free Software Foundation, Inc.echo 59 Temple Place, Suite 330echo Boston, MA 02111-1307, USA.echo.set /P CHS= Press H for help or Q for quit?CLSif /I %CHS%=H goto :HELPif /I %CHS%=Q goto :QUIT_EXTgoto GNU_GPL:VERSIONecho Checking system version .if /I %NT_SERVER_CHK%=FALSE goto :SKIP_NT_SERVER_CHKREM Checking for running server version%regedit% /e %TEMP%svr.txt HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlProductOptionstype %TEMP%svr.txt|%find% /i Server NULif not errorlevel 1 set SERVER=TRUEtype %TEMP%svr.txt|%find% /i LanMan NULif not errorlevel 1 set SERVER=TRUEif exist %TEMP%svr.txt del /F /Q %TEMP%svr.txtif /I %SERVER%=TRUE goto :NTSERVER:SKIP_NT_SERVER_CHKver | %find% /i Windows 2000 nulif not errorlevel 1 goto :OS2Kver | %find% /i Windows XP nulif not errorlevel 1 goto :OSXPver | %find% /i Microsoft Windows Version 5.2.3790 nulif not errorlevel 1 goto :OSXP64echo !Failed!echo _echo.echo Dieses Script ist nur unter Windows 2000 oder XP lauffaehig!echo.echo This script works only on Windows 2000/XP machines!echo.goto :QUIT:NOFINDecho.echo !Failed!echo _echo.echo Leider konnte folgende Datei nicht gefunden werden:echo.echo Sorry, but following file is missing:echo.echo.echo # %SystemRoot%System32FIND.EXEecho.echo.goto :QUIT:NOREGEDITecho.echo !Failed!echo _echo.echo Leider konnte folgende Datei nicht gefunden werden:echo.echo Sorry, but following file is missing:echo.echo.echo # %SystemRoot%REGEDIT.EXEecho.echo.goto :QUIT:NTSERVERecho.echo !Failed!echo _echo.echo Dieses Script unterstuetzt keine NT Server Versionen!echo.echo This script doesnt support NT server versions!echo.goto :QUIT:OS2Krem Specific OS Detection Iset SYSTEM=2krem Testing for XP ServicePacks%regedit% /e %TEMP%svclist.txt HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersiontype %TEMP%svclist.txt|%find% /i Service Pack 4 NULif errorlevel=1 (type %TEMP%svclist.txt|%find% /i Service Pack 3 NULif errorlevel=1 (type %TEMP%svclist.txt|%find% /i Service Pack 2 NULif errorlevel=1 (type %TEMP%svclist.txt|%find% /i Service Pack 1 NULif errorlevel=1 (echo !Windows 2000 no or unknown Service Pack detected!goto NO_2KSP)echo !Windows 2000 Service Pack 1 detected!goto :NO_2KSP)echo !Windows 2000 Service Pack 2 detected!goto :NO_2KSP)echo !Windows 2000 Service Pack 3 detected!goto :NO_2KSP)echo !Windows 2000 Service Pack 4 detected!goto :NO_2KSP:NO_2kSPif exist %TEMP%svclist.txt del /F /Q %TEMP%svclist.txtgoto :CONTINUE:OSXPrem Specific OS detection IIset SYSTEM=xprem Testing for XP ServicePack 2%regedit% /e %TEMP%svclist.txt HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersiontype %TEMP%svclist.txt|%find% /i Service Pack 2 NULif errorlevel=1 (type %TEMP%svclist.txt|%find% /i Service Pack 1 NULif errorlevel=1 (SET XPSP2=FALSEecho !Windows XP no or unknown Service Pack detected!goto NO_XPSP)SET XPSP2=FALSEecho !Windows XP Service Pack 1 detected!goto :NO_XPSP)SET XPSP2=TRUEecho !Windows XP ServicePack 2 detected!goto :NO_XPSP:OSXP64rem Specific OS detection IIset SYSTEM=xprem Testing for XP ServicePack 2%regedit% /e %TEMP%svclist.txt HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersiontype %TEMP%svclist.txt|%find% /i Service Pack 2 NULif errorlevel=1 (type %TEMP%svclist.txt|%find% /i Service Pack 1 NULif errorlevel=1 (SET XPSP2=FALSEecho !EXPERIMENTAL! Windows XP64 no or unknown Service Pack detected!goto NO_XPSP)SET XPSP2=FALSEecho !EXPERIMENTAL! Windows XP64 Service Pack 1 detected!goto :NO_XPSP)SET XPSP2=TRUEecho !EXPERIMENTAL! Windows XP64 ServicePack 2 detected!goto :NO_XPSP:NO_XPSPif exist %TEMP%svclist.txt del /F /Q %TEMP%svclist.txtgoto :CONTINUE:CONTINUEREM Creating subdirectory ntsvcfg in userprofile if necessaryif not exist %USERPROFILE%ntsvcfg*.* mkdir %USERPROFILE%ntsvcfgREM Moving old script backup files to .%USERNAME%ntsvcfg :if exist %USERPROFILE%dcom.reg move /Y %USERPROFILE%dcom.reg %USERPROFILE%ntsvcfgdcom.regif exist %USERPROFILE%dcomp.reg move /Y %USERPROFILE%dcomp.reg %USERPROFILE%ntsvcfgdcomp.regif exist %USERPROFILE%services.reg move /Y %USERPROFILE%services.reg %USERPROFILE%ntsvcfgservices.regif exist %USERPROFILE%current_services_config.reg move /Y %USERPROFILE%current_services_config.reg %USERPROFILE%ntsvcfgcurrent_services_config.regif exist %USERPROFILE%smb.reg move /Y %USERPROFILE%smb.reg %USERPROFILE%ntsvcfgsmb.regif exist %USERPROFILE%FPRINT.REF move /Y %USERPROFILE%FPRINT.REF %USERPROFILE%ntsvcfgFPRINT.REFif exist %USERPROFILE%handler_aim.reg move /Y %USERPROFILE%handler_aim.reg %USERPROFILE%ntsvcfghandler_aim.regif exist %USERPROFILE%handler_gopher.reg move /Y %USERPROFILE%handler_gopher.reg %USERPROFILE%ntsvcfghandler_gopher.regif exist %USERPROFILE%handler_telnet.reg move /Y %USERPROFILE%handler_telnet.reg %USERPROFILE%ntsvcfghandler_telnet.regif exist %USERPROFILE%services.reg.default move /Y %USERPROFILE%services.reg.default %USERPROFILE%ntsvcfgservices.reg.defaultif exist %USERPROFILE%dcom.reg.default move /Y %USERPROFILE%dcom.reg.default %USERPROFILE%ntsvcfgdcom.reg.defaultif exist %USERPROFILE%dcomp.reg.default move /Y %USERPROFILE%dcomp.reg.default %USERPROFILE%ntsvcfgdcomp.reg.defaultif exist %USERPROFILE%smb.reg.default move /Y %USERPROFILE%smb.reg.default %USERPROFILE%ntsvcfgsmb.reg.defaultif exist %USERPROFILE%handler_aim.reg.default move /Y %USERPROFILE%handler_aim.reg.default %USERPROFILE%ntsvcfghandler_aim.reg.defaultif exist %USERPROFILE%handler_gopher.reg.default move /Y %USERPROFILE%handler_gopher.reg.default %USERPROFILE%ntsvcfghandler_gopher.reg.defaultif exist %USERPROFILE%handler_telnet.reg.default move /Y %USERPROFILE%handler_telnet.reg.default %USERPROFILE%ntsvcfghandler_telnet.reg.defaultREM *Declarations*set SELECT=noset SVC_BAK=%USERPROFILE%ntsvcfgservices.regset SVC_SAV=%USERPROFILE%ntsvcfgcurrent_services_config.regset DCOM_BAK=%USERPROFILE%ntsvcfgdcom.regset DCOMP_BAK=%USERPROFILE%ntsvcfgdcomp.regset SMB_BAK=%USERPROFILE%ntsvcfgsmb.regset DCOM_TMP=%TEMP%dcomoff.regset DCOMP_TMP=%TEMP%dcompoff.regset SMB_TMP=%TEMP%smboff.regset FPRINT=%USERPROFILE%ntsvcfgFPRINT.REFset HANDLER1=%USERPROFILE%ntsvcfghandler_aim.regset HANDLER2=%USERPROFILE%ntsvcfghandler_gopher.regset HANDLER3=%USERPROFILE%ntsvcfghandler_telnet.regset NB_TMP=%TEMP%nb_off.vbsset srctmp=%USERPROFILE%ntsvcfgsrcreate.vbsset DHCP_CHANGES=YESREM *Options*set SCHEDULER_ENABLED=NOset UseXPSysRestore=YESset RESTORE=NOset SVC_MOD=NOset USE_FPRINT=YESset Deactivate_NetBIOS=YESset RESTORE_MODE=2REM *APP_PATHs*set NET=%SystemRoot%system32net.exeset SC=%SystemRoot%system32sc.exeset FC=%SystemRoot%system32fc.exeset IPCONFIG=%SystemRoot%system32ipconfig.exeecho Checking available permissions: local, please wait .%net% user %USERNAME% 2 nul | %find% /i admin | %find% /i /v name nulif errorlevel 1 (echo : domain, please wait .%net% user %USERNAME% /domain 2 nul | %find% /i admin | %find% /i /v name nulif errorlevel 1 (echo.echo Failed!echo _echo Leider verfuegen Sie nicht ueber die erforderlichen Rechte!echo Melden Sie sich bitte als Administrator an.echo.echo Sorry but you dont have the permissions required for this task.echo Please login as Administrator.echo.goto :END)set IMPORT_OLD_FILES=FALSErem searching for sc.exeif not exist %FPRINT% echo Checking for presence of SC.EXE .%sc% qc nul 2&1if errorlevel 1 (echo !Failed!echo _echo Die notwendige Datei SC.EXE konnte leider nicht unterecho %SystemRoot%SYSTEM32 gefunden werden.echo Bitte laden Sie sich diese Datei von der unten genannten Adresse herunter:echo.echo SC.EXE couldnt be found in %SystemRoot%SYSTEM32.echo Please download it from following location:echo.echo.echo -= /reskit/win2000/sc.zip =-echo.echo Self-installing SC.EXEecho =echo svx2kxp.cmd kann versuchen, die notwendige Datei selbst zu installieren.echo Hierzu benoetigen Sie eine bestehende Internetverbindung.echo.echo svc2kxp.cmd may try to download the required file SC.EXE itself if anecho active internet connection exists.goto :SC_DOWNLOAD)if /I %1=/all (set SELECT=/allgoto :SKIP_MENUE)if /I %1=/relan (set SELECT=/relangoto :SKIP_MENUE)if /I %1=/std (set SELECT=/stdgoto :SKIP_MENUE)if /I %1=/default goto :RESTORE_DEFAULTSrem checking for modified servicesif /I %CHK_SVC%=YES (if /I %USE_FPRINT%=YES (if exist %FPRINT% (rem Creating fingerprint of current service settings.if exist %USERPROFILE%ntsvcfgsvc2cmp.sav del /F /Q %USERPROFILE%ntsvcfgsvc2cmp.sav%sc% query type= service state= all bufsize= 8192 | %FIND% SERVICE_NAME %TEMP%svclist.txtfor /F tokens=1* %a in (%TEMP%svclist.txt) do (echo %b %USERPROFILE%ntsvcfgsvc2cmp.sav%sc% query %b | %FIND% STATE %USERPROFILE%ntsvcfgsvc2cmp.sav%sc% qc %b | %FIND% DISPLAY_NAME %USERPROFILE%ntsvcfgsvc2cmp.sav%SC% qc %b | %FIND% START_TYPE %USERPROFILE%ntsvcfgsvc2cmp.savecho. %USERPROFILE%ntsvcfgsvc2cmp.sav)del %TEMP%svclist.txt%FC% %FPRINT% %USERPROFILE%ntsvcfgsvc2cmp.sav NULif errorlevel 1 goto :DIFFgoto OK:DIFFecho Checking for modified services . failed-services maybe modified! Evaluateset SVC_MOD=YESgoto :MOD_END:OKecho Checking for modified services . OKset SVC_MOD=NOif exist %USERPROFILE%ntsvcfgsvc2cmp.sav del /F /Q %USERPROFILE%ntsvcfgsvc2cmp.savgoto :MOD_END:MOD_ENDREM)set CHK_SVC=NOif /I %1=/restore goto :RESTORE:MENUEif /I %1=/lan goto :SKIP_MENUEecho.set /P CHS= 请选择您的优化方式: 1深度优化 2简洁优化 :选择后按回车键继续if /I %CHS%=1 (set SELECT=/langoto :SKIP_MENUE)if /I %CHS%=2 (set SELECT=/stdgoto :SKIP_MENUE)if /I %CHS%=3 (set SELECT=/allgoto :SKIP_MENUE)if /I %CHS%=4 goto :RESTOREif /I %CHS%=R goto :RESTOREif /I %CHS%=M goto :MORE_OPTIONSif /I %SVC_MOD%=YES if /I %CHS%=E goto :EVALUATE_SERVICESif /I %CHS%=G goto :CREATING_NEW_FINGERPRINTif /I %CHS%=Q goto :QUITclsgoto :START:SKIP_MENUErem Checking if old restorefiles exists.rem if it is so old files will be restored before new changesif not exist %SVC_BAK% goto :NO_RESTOREif /I %RESTORE_MODE%=3 goto :NO_RESTOREif /I %RESTORE_MODE%=4 goto :NO_RESTOREset RESTORE=YESecho.echo _echo.echo Selected Restore Mode: %RESTORE_MODE%echo.echo # Achtung: Alte Sicherungsdateien gefunden!echo.echo Svc2kXp.cmd wurde schon einmal ausgefuehrt. Damit neue Aenderungenecho korrekt durchgefuehrt werden koennen, werden die Sicherungsdateienecho eingespielt.echo.echo.echo Attention: old restore-files found!echo.echo This program runs not for the first time. To apply all new changesecho correctly old restore files will used to get an definite state.echo.echo.echo # Starting restore .goto RESTORE_EXT:NO_RESTORErem query if taskplaner should runif /I %SYSTEM%=2k goto :SKIP_SQUERYif /I %SYSTEM%=xp (if /I %SELECT%= goto :SKIP_SQUERYif /I %SELECT%=/all goto :SKIP_SQUERYif /I %XPSP2%=True (set SCHEDULER_ENABLED=YESgoto :SKIP_SQUERY)echo.echo.echo Rueckfrage / Queryecho =echo.echo Soll der Dienst Taskplaner beendet werden?echo.echo Wenn sie zeitgesteuerten Aufgaben z.B. Antiviren-Updates oder die automati-echo sche Erstellung von Systemwiederherstellungspunkten nicht benoetigen, drueckenecho Sie eine BELIEBIGE TASTE, um auch Port 135 RPC sowie Port 1025 Taskplanerecho zu schliessen empfohlen!. Andernfalls druecken Sie N!echo.echo.echo Should the scheduler service be disabled?echo.echo If you have time-controlled tasks i.e. AV-Updates or you will not setecho automatic system restore points press ANY KEY TO CONTINUE to close port 135echo RPC and port 1025 scheduler instantly. Otherwise press Necho _echo.set /P UNDO= 是否对网络进行加速 Y/N? 【选择后按回车键】if /I %UNDO%=n set SCHEDULER_ENABLED=YES:SKIP_SQUERYif not exist %SVC_BAK%.default (echo.echo Creating backup of defaults .%regedit% /e %SVC_BAK%.default HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServices%regedit% /e %DCOM_BAK%.default HKEY_LOCAL_MACHINESOFTWAREMicrosoftOle%regedit% /e %DCOMP_BAK%.default HKEY_LOCAL_MACHINESOFTWAREMicrosoftRpc%regedit% /e %SMB_BAK%.default HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesNetBTParameters%regedit% /e %HANDLER1%.default HKEY_CLASSES_ROOTAIM%regedit% /e %HANDLER2%.default HKEY_CLASSES_ROOTgopher%regedit% /e %HANDLER3%.default HKEY_CLASSES_ROOTtelnetecho

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论