找回密码
 注册
搜索
[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
查看: 9794|回复: 2

[系统相关] ghost中附带的一个WIN2K-XP超级加速脚本.cmd帮忙看看有没有错误?

[复制链接]
发表于 2012-1-31 22:18:53 | 显示全部楼层 |阅读模式
刚才ghost重装了一下系统,正在C盘中瞎晃悠的时候发现C:\Program Files有个WIN2K-XP超级加速脚本.cmd,本来想直接点击试试看是否真的能加点速度!不放心还是打开查看一下有没有搀着啥恶意代码!

打开一看代码老长了!其中的代码似懂非懂!所以想请高手帮忙看看有没有啥出错的地方,要是没问题的话那就万事OK了!正好和大家一起分享!

完整代码如下:
  1. @echo off
  2. TITLE Windows 2000/XP优化脚本
  3. color 0B
  4. cls
  5. rem Copyright (C) 2003-05 Ansgar Wiechers & Torsten Mann
  6. rem Contact: admin@ntsvcfg.de
  7. rem
  8. rem This program is free software; you can redistribute it and/or modify it under
  9. rem the terms of the GNU General Public License as published by the Free Software Foundation;
  10. rem either version 2 of the License, or (at your option) any later version.
  11. rem This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
  12. rem without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. rem See the GNU General Public License for more details.
  14. rem
  15. rem You should have received a copy of the GNU General Public License along with this program;
  16. rem if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  17. rem MA 02111-1307, USA.
  18. echo.
  19. REM Tested on ... WinXP_SP2
  20. REM Always basic XP64 Support
  21. REM Modifications to BITS service (cause of v5 WindowsUpdate) - #discharged#
  22. REM Additional notices corresponding to DHCP issue
  23. REM Variables problems during RESTORE_DEFAULT usage fixed
  24. REM SMBDEVICEENABLED Restore Bug fixed
  25. REM Mod_history-09-27-2005**11-08-2005**11-29-2005**12-07-2005**12-18-2005

  26. setlocal

  27. REM *** INIT_VARS ***
  28. set CHK_SVC=YES
  29. set XPSP2=FALSE
  30. set SERVER=FALSE
  31. set NT_SERVER_CHK=TRUE


  32. :START
  33. echo  "Windows 2000/XP优化脚本" v2.2 Build7b (18.12.2005)
  34. echo  ================================================================
  35. set find=%SystemRoot%\System32\find.exe
  36. set regedit=%SystemRoot%\regedit.exe
  37. if not exist "%find%" goto :NOFIND
  38. if not exist "%regedit%" goto :NOREGEDIT
  39. if not "%1" == "%*" goto :SYNTAX
  40. if /I "%1"=="/?" goto :HELP
  41. if /I "%1"=="/help" goto :HELP
  42. if /I "%1"=="-h" goto :HELP
  43. if /I "%1"=="--help" goto :HELP
  44. if /I "%1"=="-?" goto :HELP
  45. if /I "%1"=="--?" goto :HELP
  46. if /I "%1"=="/fix" goto :FIX
  47. goto :VERSION

  48. :SYNTAX
  49. echo.
  50. echo.
  51. echo  !!Syntax error!!
  52. echo  ________________
  53. echo  Es kann nur ein oder kein Parameter angegeben werden.
  54. echo.
  55. echo  Only one or no parameter allowed.
  56. goto :QUIT

  57. :HELP
  58. echo.
  59. echo                                 -= Hilfe =-
  60. echo  Parameter:
  61. echo  /lan.......Einige Dienste fuer LAN-Betrieb werden nicht veraendert.
  62. echo  /std.......Schliesst alle Ports, einige Dienste bleiben unveraendert.
  63. echo  /all.......Setzt alle Vorschlaege nach www.ntsvcfg.de um (hardening).
  64. echo  /restore...Nimmt die zuletzt vorgenommenen Aenderungen zurueck.
  65. echo  /reLAN.....Reaktiviert Dienste, die fuer LAN-Betrieb benoetigt werden.
  66. echo  /default...Setzt alle Diensteinstellungen auf urspr黱gliche Werte zur點k.
  67. echo.
  68. echo  Parameters:
  69. echo  /lan.......Some services needed for LAN-usage stay unchanged!
  70. echo  /std.......Closes all Ports, but some services stay unchanged
  71. echo  /all.......Changes all issues recommended by www.ntsvcfg.de ("hardening")
  72. echo  /restore...Undo last changes.
  73. echo  /reLAN.....Reactivates services required for LAN.
  74. echo  /default...Restoring factory service settings (before first time usage)
  75. echo.
  76. echo  example: svc2kxp.cmd /all
  77. echo.
  78. set /P CHS= [Press "G" for GNU GPL informations or "Q" for quit]?
  79. if /I "%CHS%"=="G" goto :GNU_GPL
  80. if /I "%CHS%"=="Q" goto :QUIT_EXT
  81. CLS
  82. goto :HELP

  83. :GNU_GPL
  84. CLS
  85. echo  Informations about GNU-General Public License for "svc2kxp.cmd"
  86. echo  ===============================================================
  87. echo.
  88. echo  Copyright (C) 2003-05 Ansgar Wiechers, Torsten Mann
  89. echo  Contact: admin@ntsvcfg.de
  90. echo.
  91. echo  This program is free software; you can redistribute it and/or modify it under
  92. echo  the terms of the GNU General Public License as published by the Free Software
  93. echo  Foundation; either version 2 of the License, or (at your option) any later
  94. echo  version. This program is distributed in the hope that it will be useful, but
  95. echo  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  96. echo  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  97. echo  details.
  98. echo.
  99. echo  You should have received a copy of the GNU General Public License along with
  100. echo  this program; if not, write to the:
  101. echo.
  102. echo  Free Software Foundation, Inc.
  103. echo  59 Temple Place, Suite 330
  104. echo  Boston, MA 02111-1307, USA.
  105. echo.
  106. set /P CHS= [Press "H" for help or "Q" for quit]?
  107. CLS
  108. if /I "%CHS%"=="H" goto :HELP
  109. if /I "%CHS%"=="Q" goto :QUIT_EXT
  110. goto GNU_GPL

  111. :VERSION
  112. echo  正在检查操作系统版本 ...


  113. if /I "%NT_SERVER_CHK%"=="FALSE" goto :SKIP_NT_SERVER_CHK
  114. REM Checking for running server version
  115.         "%regedit%" /e "%TEMP%\~svr.txt" "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ProductOptions"
  116.                  type "%TEMP%\~svr.txt"|"%find%" /i "Server" >NUL
  117.                 if not errorlevel 1 set SERVER=TRUE
  118.                  type "%TEMP%\~svr.txt"|"%find%" /i "LanMan" >NUL
  119.                 if not errorlevel 1 set SERVER=TRUE
  120.                 if exist "%TEMP%\~svr.txt" del /F /Q "%TEMP%\~svr.txt"
  121.                 if /I "%SERVER%"=="TRUE" goto :NTSERVER


  122. :SKIP_NT_SERVER_CHK

  123. ver | "%find%"  /i "Windows 2000" > nul
  124. if not errorlevel 1 goto :OS2K

  125. ver | "%find%"  /i "Windows XP" > nul
  126. if not errorlevel 1 goto :OSXP

  127. ver | "%find%"  /i "Microsoft Windows [Version 5.2.3790]" > nul
  128. if not errorlevel 1 goto :OSXP64

  129. echo  !!Failed!!
  130. echo  __________
  131. echo.
  132. echo  Dieses Script ist nur unter Windows 2000 oder XP lauffaehig!
  133. echo.
  134. echo  This script works only on Windows 2000/XP machines!
  135. echo.
  136. goto :QUIT

  137. :NOFIND
  138. echo.
  139. echo  !!Failed!!
  140. echo  __________
  141. echo.
  142. echo  Leider konnte folgende Datei nicht gefunden werden:
  143. echo.
  144. echo  Sorry, but following file is missing:
  145. echo.
  146. echo.
  147. echo  # %SystemRoot%\System32\FIND.EXE
  148. echo.
  149. echo.
  150. goto :QUIT

  151. :NOREGEDIT
  152. echo.
  153. echo  !!Failed!!
  154. echo  __________
  155. echo.
  156. echo  Leider konnte folgende Datei nicht gefunden werden:
  157. echo.
  158. echo  Sorry, but following file is missing:
  159. echo.
  160. echo.
  161. echo  # %SystemRoot%\REGEDIT.EXE
  162. echo.
  163. echo.
  164. goto :QUIT

  165. :NTSERVER
  166. echo.
  167. echo  !!Failed!!
  168. echo  __________
  169. echo.
  170. echo  Dieses Script unterstuetzt keine NT Server Versionen!
  171. echo.
  172. echo  This script doesn't support NT server versions!
  173. echo.
  174. goto :QUIT


  175. :OS2K
  176. rem Specific OS Detection I
  177. set SYSTEM=2k

  178. rem Testing for XP ServicePacks

  179.         "%regedit%" /e "%TEMP%\~svclist.txt" "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion"
  180.         type "%TEMP%\~svclist.txt"|"%find%" /i "Service Pack 4" >NUL
  181.         if errorlevel==1 (

  182.                   type "%TEMP%\~svclist.txt"|"%find%" /i "Service Pack 3" >NUL
  183.                   if errorlevel==1 (

  184.                         type "%TEMP%\~svclist.txt"|"%find%" /i "Service Pack 2" >NUL
  185.                           if errorlevel==1 (

  186.                                 type "%TEMP%\~svclist.txt"|"%find%" /i "Service Pack 1" >NUL
  187.                                 if errorlevel==1 (

  188.                                         echo  ! 检测到 Windows 2000 [没有或未知 Service Pack]
  189.                                         goto NO_2KSP
  190.                                         )

  191.                                 echo  ! 检测到 Windows 2000 [Service Pack 1]
  192.                                   goto :NO_2KSP
  193.                                 )


  194.                         echo  ! 检测到 Windows 2000  [Service Pack 2]
  195.                           goto :NO_2KSP
  196.                         )


  197.                 echo  ! 检测到 Windows 2000  [Service Pack 3]
  198.                 goto :NO_2KSP
  199.                 )


  200.         echo  ! 检测到 Windows 2000  [Service Pack 4]
  201.         goto :NO_2KSP

  202. :NO_2kSP
  203. if exist "%TEMP%\~svclist.txt" del /F /Q "%TEMP%\~svclist.txt"
  204. goto :CONTINUE


  205. :OSXP
  206. rem Specific OS detection II
  207. set SYSTEM=xp
  208. rem Testing for XP ServicePack 2

  209.         "%regedit%" /e "%TEMP%\~svclist.txt" "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion"
  210.         type "%TEMP%\~svclist.txt"|"%find%" /i "Service Pack 2" >NUL
  211.         if errorlevel==1 (

  212.                   type "%TEMP%\~svclist.txt"|"%find%" /i "Service Pack 1" >NUL
  213.                   if errorlevel==1 (

  214.                         SET XPSP2=FALSE
  215.                         echo  ! 检测到 Windows XP [没有或未知 Service Pack]
  216.                         goto NO_XPSP
  217.                         )

  218.                 SET XPSP2=FALSE
  219.                   echo  ! 检测到 Windows XP  [Service Pack 1]
  220.                   goto :NO_XPSP
  221.                 )

  222.         SET XPSP2=TRUE
  223.         echo  ! 检测到 Windows XP  [ServicePack 2]
  224.         goto :NO_XPSP

  225. :OSXP64
  226. rem Specific OS detection II
  227. set SYSTEM=xp
  228. rem Testing for XP ServicePack 2

  229.         "%regedit%" /e "%TEMP%\~svclist.txt" "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion"
  230.         type "%TEMP%\~svclist.txt"|"%find%" /i "Service Pack 2" >NUL
  231.         if errorlevel==1 (

  232.                   type "%TEMP%\~svclist.txt"|"%find%" /i "Service Pack 1" >NUL
  233.                   if errorlevel==1 (

  234.                         SET XPSP2=FALSE
  235.                         echo  !EXPERIMENTAL! Windows XP64 [no or unknown Service Pack] detected!
  236.                         goto NO_XPSP
  237.                         )

  238.                 SET XPSP2=FALSE
  239.                   echo  !EXPERIMENTAL! Windows XP64 [Service Pack 1] detected!
  240.                   goto :NO_XPSP
  241.                 )

  242.         SET XPSP2=TRUE
  243.         echo  !EXPERIMENTAL! Windows XP64 [ServicePack 2] detected!
  244.         goto :NO_XPSP


  245. :NO_XPSP
  246. if exist "%TEMP%\~svclist.txt" del /F /Q "%TEMP%\~svclist.txt"
  247. goto :CONTINUE


  248. :CONTINUE

  249. REM Creating subdirectory "ntsvcfg" in userprofile if necessary
  250. if not exist "%USERPROFILE%\ntsvcfg\*.*" mkdir "%USERPROFILE%\ntsvcfg"

  251. REM Moving old script backup files to ...\%USERNAME%\ntsvcfg :
  252.         if exist "%USERPROFILE%\dcom.reg" move /Y "%USERPROFILE%\dcom.reg" "%USERPROFILE%\ntsvcfg\dcom.reg"
  253.         if exist "%USERPROFILE%\dcomp.reg" move /Y "%USERPROFILE%\dcomp.reg" "%USERPROFILE%\ntsvcfg\dcomp.reg"
  254.         if exist "%USERPROFILE%\services.reg" move /Y "%USERPROFILE%\services.reg" "%USERPROFILE%\ntsvcfg\services.reg"
  255.         if exist "%USERPROFILE%\current_services_config.reg" move /Y "%USERPROFILE%\current_services_config.reg" "%USERPROFILE%\ntsvcfg\current_services_config.reg"
  256.         if exist "%USERPROFILE%\smb.reg" move /Y "%USERPROFILE%\smb.reg" "%USERPROFILE%\ntsvcfg\smb.reg"
  257.         if exist "%USERPROFILE%\FPRINT.REF" move /Y "%USERPROFILE%\FPRINT.REF" "%USERPROFILE%\ntsvcfg\FPRINT.REF"
  258.         if exist "%USERPROFILE%\handler_aim.reg" move /Y "%USERPROFILE%\handler_aim.reg" "%USERPROFILE%\ntsvcfg\handler_aim.reg"
  259.         if exist "%USERPROFILE%\handler_gopher.reg" move /Y "%USERPROFILE%\handler_gopher.reg" "%USERPROFILE%\ntsvcfg\handler_gopher.reg"
  260.         if exist "%USERPROFILE%\handler_telnet.reg" move /Y "%USERPROFILE%\handler_telnet.reg" "%USERPROFILE%\ntsvcfg\handler_telnet.reg"
  261.         if exist "%USERPROFILE%\services.reg.default" move /Y "%USERPROFILE%\services.reg.default" "%USERPROFILE%\ntsvcfg\services.reg.default"
  262.         if exist "%USERPROFILE%\dcom.reg.default" move /Y "%USERPROFILE%\dcom.reg.default" "%USERPROFILE%\ntsvcfg\dcom.reg.default"
  263.         if exist "%USERPROFILE%\dcomp.reg.default" move /Y "%USERPROFILE%\dcomp.reg.default" "%USERPROFILE%\ntsvcfg\dcomp.reg.default"
  264.         if exist "%USERPROFILE%\smb.reg.default" move /Y "%USERPROFILE%\smb.reg.default" "%USERPROFILE%\ntsvcfg\smb.reg.default"
  265.         if exist "%USERPROFILE%\handler_aim.reg.default" move /Y "%USERPROFILE%\handler_aim.reg.default" "%USERPROFILE%\ntsvcfg\handler_aim.reg.default"
  266.         if exist "%USERPROFILE%\handler_gopher.reg.default" move /Y "%USERPROFILE%\handler_gopher.reg.default" "%USERPROFILE%\ntsvcfg\handler_gopher.reg.default"
  267.         if exist "%USERPROFILE%\handler_telnet.reg.default" move /Y "%USERPROFILE%\handler_telnet.reg.default" "%USERPROFILE%\ntsvcfg\handler_telnet.reg.default"


  268. REM *****Declarations*****
  269. set SELECT="no"
  270. set SVC_BAK=%USERPROFILE%\ntsvcfg\services.reg
  271. set SVC_SAV=%USERPROFILE%\ntsvcfg\current_services_config.reg
  272. set DCOM_BAK=%USERPROFILE%\ntsvcfg\dcom.reg
  273. set DCOMP_BAK=%USERPROFILE%\ntsvcfg\dcomp.reg
  274. set SMB_BAK=%USERPROFILE%\ntsvcfg\smb.reg
  275. set DCOM_TMP=%TEMP%\dcomoff.reg
  276. set DCOMP_TMP=%TEMP%\dcompoff.reg
  277. set SMB_TMP=%TEMP%\smboff.reg
  278. set FPRINT=%USERPROFILE%\ntsvcfg\FPRINT.REF
  279. set HANDLER1=%USERPROFILE%\ntsvcfg\handler_aim.reg
  280. set HANDLER2=%USERPROFILE%\ntsvcfg\handler_gopher.reg
  281. set HANDLER3=%USERPROFILE%\ntsvcfg\handler_telnet.reg
  282. set NB_TMP=%TEMP%\nb_off.vbs
  283. set srctmp=%USERPROFILE%\ntsvcfg\~srcreate.vbs
  284. set DHCP_CHANGES="YES"

  285. REM *****Options*****
  286. set SCHEDULER_ENABLED=NO
  287. set UseXPSysRestore=YES
  288. set RESTORE=NO
  289. set SVC_MOD=NO
  290. set USE_FPRINT=YES
  291. set Deactivate_NetBIOS=YES
  292. set RESTORE_MODE=2

  293. REM *****APP_PATHs******
  294. set NET=%SystemRoot%\system32\net.exe
  295. set SC=%SystemRoot%\system32\sc.exe
  296. set FC=%SystemRoot%\system32\fc.exe
  297. set IPCONFIG=%SystemRoot%\system32\ipconfig.exe


  298. echo  Checking available permissions: [local], please wait ...
  299. "%net%" user "%USERNAME%" 2> nul | "%find%"  /i "admin" | "%find%"  /i /v "name" > nul
  300. if errorlevel 1 (
  301.         echo     "         "          "     : [domain], please wait ...
  302.         "%net%" user "%USERNAME%" /domain 2> nul | "%find%"  /i "admin" | "%find%"  /i /v "name" > nul
  303.         if errorlevel 1 (
  304.                 echo.
  305.                 echo  Failed!
  306.                 echo  __________
  307.                 echo  Leider verfuegen Sie nicht ueber die erforderlichen Rechte!
  308.                 echo  Melden Sie sich bitte als Administrator an.
  309.                 echo.
  310.                 echo  Sorry but you don't have the permissions required for this task.
  311.                 echo  Please login as Administrator.
  312.                 echo.
  313.                 goto :END
  314.                 )
  315.         )

  316. set IMPORT_OLD_FILES=FALSE
  317. rem searching for sc.exe
  318. if not exist "%FPRINT%" echo  Checking for presence of SC.EXE ...
  319. "%sc%" qc > nul 2>&1
  320. if errorlevel 1 (
  321.         echo  !!Failed!!
  322.         echo  __________
  323.         echo  Die notwendige Datei SC.EXE konnte leider nicht unter
  324.         echo  [%SystemRoot%\SYSTEM32\] gefunden werden.
  325.         echo  Bitte laden Sie sich diese Datei von der unten genannten Adresse herunter:
  326.         echo.
  327.         echo  SC.EXE couldn't be found in [%SystemRoot%\SYSTEM32\].
  328.         echo  Please download it from following location:
  329.         echo.
  330.         echo.
  331.         echo            -= ftp://ftp.microsoft.com/reskit/win2000/sc.zip =-
  332.         echo.
  333.         echo                                Self-installing SC.EXE
  334.         echo                                ======================
  335.         echo  svx2kxp.cmd kann versuchen, die notwendige Datei selbst zu installieren.
  336.         echo  Hierzu benoetigen Sie eine bestehende Internetverbindung.
  337.         echo.
  338.         echo  svc2kxp.cmd may try to download the required file SC.EXE itself if an
  339.         echo  active internet connection exists.
  340.         goto :SC_DOWNLOAD
  341.         )


  342. if /I "%1"=="/all" (
  343.         set SELECT="/all"
  344.         goto :SKIP_MENUE
  345.         )

  346. if /I "%1"=="/relan" (
  347.         set SELECT="/relan"
  348.         goto :SKIP_MENUE
  349.         )

  350. if /I "%1"=="/std" (
  351.         set SELECT="/std"
  352.         goto :SKIP_MENUE
  353.         )

  354. if /I "%1"=="/default" goto :RESTORE_DEFAULTS


  355. rem checking for modified services
  356. if /I %CHK_SVC%==YES (
  357.         if /I %USE_FPRINT%==YES (
  358.                 if exist "%FPRINT%" (
  359.                         rem Creating fingerprint of current service settings...
  360.                         if exist "%USERPROFILE%\ntsvcfg\svc2cmp.sav" del /F /Q "%USERPROFILE%\ntsvcfg\svc2cmp.sav"
  361.                         "%sc%" query type= service state= all bufsize= 8192 | %FIND% "SERVICE_NAME" >%TEMP%\~svclist.txt
  362.                         for /F "tokens=1*" %%a in (%TEMP%\~svclist.txt) do (
  363.                                 echo %%b >>"%USERPROFILE%\ntsvcfg\svc2cmp.sav"
  364.                                 "%sc%" query "%%b" | %FIND% "STATE" >>"%USERPROFILE%\ntsvcfg\svc2cmp.sav"
  365.                                 "%sc%" qc "%%b" | %FIND% "DISPLAY_NAME" >>"%USERPROFILE%\ntsvcfg\svc2cmp.sav"
  366.                                 "%SC%" qc "%%b" | %FIND% "START_TYPE" >>"%USERPROFILE%\ntsvcfg\svc2cmp.sav"
  367.                                 echo. >> "%USERPROFILE%\ntsvcfg\svc2cmp.sav"
  368.                                 )
  369.                         del "%TEMP%\~svclist.txt"


  370.                         "%FC%" "%FPRINT%" "%USERPROFILE%\ntsvcfg\svc2cmp.sav" >NUL
  371.                         if errorlevel 1 goto :DIFF
  372.                         goto OK

  373.                         :DIFF
  374.                         echo  Checking for modified services ... failed-services maybe modified! [E]valuate
  375.                         set SVC_MOD=YES
  376.                         goto :MOD_END

  377.                         :OK
  378.                         echo  Checking for modified services ... OK
  379.                         set SVC_MOD=NO
  380.                         if exist "%USERPROFILE%\ntsvcfg\svc2cmp.sav" del /F /Q "%USERPROFILE%\ntsvcfg\svc2cmp.sav"
  381.                         goto :MOD_END

  382.                         :MOD_END
  383.                         REM
  384.                         )
  385.                 )
  386.         )
  387. set CHK_SVC=NO


  388. if /I "%1"=="/restore" goto :RESTORE


  389. :MENUE
  390. if /I "%1"=="/lan" goto :SKIP_MENUE
  391. echo.
  392. echo.
  393. echo.
  394. echo.
  395. echo.
  396. echo.
  397. echo.
  398. echo.
  399. echo.
  400. echo.
  401. echo.
  402. echo.
  403. echo.
  404. echo.
  405. echo.
  406. echo.
  407. echo.
  408. echo.
  409. echo  ______________________________________________________________________________
  410. echo.
  411. echo  请选择一个适合您的方案继续:
  412. echo.
  413. echo  (1) 网络: 适用于有本地局域网连接的计算机。
  414. echo  (2) 标准: 适用于有Internet连接但没有局域网的单机。
  415. echo  (3) 全部: 最大程度的优化;详细参见 www.ntsvcfg.de
  416. echo  (4) 还原: 还原到上一次的状态。
  417. echo.
  418. set /P CHS= 请选择合适您的优化方案: [1],[2],[3],[4], [M]更多方案 [Q]退出?

  419. if /I "%CHS%"=="1" (
  420.         set SELECT="/lan"
  421.         goto :SKIP_MENUE
  422.         )

  423. if /I "%CHS%"=="2" (
  424.         set SELECT="/std"
  425.         goto :SKIP_MENUE
  426.         )

  427. if /I "%CHS%"=="3" (
  428.         set SELECT="/all"
  429.         goto :SKIP_MENUE
  430.         )

  431. if /I "%CHS%"=="4" goto :RESTORE
  432. if /I "%CHS%"=="R" goto :RESTORE
  433. if /I "%CHS%"=="M" goto :MORE_OPTIONS
  434. if /I "%SVC_MOD%"=="YES" if /I "%CHS%"=="E" goto :EVALUATE_SERVICES
  435. if /I "%CHS%"=="G" goto :CREATING_NEW_FINGERPRINT
  436. if /I "%CHS%"=="Q" goto :QUIT
  437. cls
  438. goto :START


  439. :SKIP_MENUE



  440. rem Checking if old restorefiles exists.
  441. rem if it is so old files will be restored before new changes
  442. if not exist "%SVC_BAK%" goto :NO_RESTORE
  443. if /I %RESTORE_MODE%==3 goto :NO_RESTORE
  444. if /I %RESTORE_MODE%==4 goto :NO_RESTORE
  445. set RESTORE=YES
  446. echo.
  447. echo  _______________________________________________________________________
  448. echo.
  449. echo  [Selected Restore Mode: %RESTORE_MODE%]
  450. echo.
  451. echo  # Achtung: Alte Sicherungsdateien gefunden!
  452. echo.
  453. echo     "Svc2kXp.cmd" wurde schon einmal ausgefuehrt. Damit neue Aenderungen
  454. echo     korrekt durchgefuehrt werden koennen, werden die Sicherungsdateien
  455. echo     eingespielt.
  456. echo.
  457. echo.
  458. echo    Attention: old restore-files found!
  459. echo.
  460. echo     This program runs not for the first time. To apply all new changes
  461. echo     correctly old restore files will used to get an definite state.
  462. echo.
  463. echo.
  464. echo  # Starting restore ...
  465. goto RESTORE_EXT



  466. :NO_RESTORE
  467. rem query if taskplaner should run
  468. if /I "%SYSTEM%"=="2k" goto :SKIP_SQUERY
  469. if /I "%SYSTEM%"=="xp" (
  470.         if /I %SELECT%=="" goto :SKIP_SQUERY
  471.         if /I %SELECT%=="/all" goto :SKIP_SQUERY
  472.         if /I %XPSP2%==True (
  473.                 set SCHEDULER_ENABLED=YES
  474.                 goto :SKIP_SQUERY
  475.                 )

  476.         )


  477. echo.
  478. echo.
  479. echo  Rueckfrage / Query
  480. echo  ==================
  481. echo.
  482. echo  Soll der Dienst "Taskplaner" beendet werden?
  483. echo.
  484. echo  Wenn sie zeitgesteuerten Aufgaben [z.B. Antiviren-Updates] oder die automati-
  485. echo  sche Erstellung von Systemwiederherstellungspunkten nicht benoetigen, druecken
  486. echo  Sie eine BELIEBIGE TASTE, um auch Port 135 [RPC] sowie Port 1025 [Taskplaner]
  487. echo  zu schliessen [empfohlen!]. Andernfalls druecken Sie "N"!
  488. echo.
  489. echo.
  490. echo  Should the "scheduler service" be disabled?
  491. echo.
  492. echo  If you have time-controlled tasks [i.e. AV-Updates] or you will not set
  493. echo  automatic system restore points press ANY KEY TO CONTINUE to close port 135
  494. echo  [RPC] and port 1025 [scheduler] instantly. Otherwise press "N"
  495. echo  ___________________________________________
  496. echo.
  497. set /P UNDO= Taskplaner beenden - Close scheduler [y/n]?
  498. if /I "%UNDO%"=="n" set SCHEDULER_ENABLED=YES



  499. :SKIP_SQUERY

  500. if not exist "%SVC_BAK%.default" (
  501.         echo.
  502.         echo  Creating backup of defaults ...
  503.         "%regedit%" /e "%SVC_BAK%.default" HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services
  504.         "%regedit%" /e "%DCOM_BAK%.default" HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Ole
  505.         "%regedit%" /e "%DCOMP_BAK%.default" HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Rpc
  506.         "%regedit%" /e "%SMB_BAK%.default" HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NetBT\Parameters
  507.         "%regedit%" /e "%HANDLER1%.default" HKEY_CLASSES_ROOT\AIM
  508.         "%regedit%" /e "%HANDLER2%.default" HKEY_CLASSES_ROOT\gopher
  509.         "%regedit%" /e "%HANDLER3%.default" HKEY_CLASSES_ROOT\telnet
  510.         echo                             ... done.
  511.         )

  512. if exist "%SVC_BAK%" (
  513.         if /I %RESTORE_MODE%==2 goto :SKIP_SAVING
  514.         if /I %RESTORE_MODE%==4 goto :SKIP_SAVING
  515.         )

  516. rem saving registry settings
  517. echo  _________________________________________________________________________
  518. echo.
  519. echo  [Selected Restore Mode: %RESTORE_MODE%]
  520. echo.
  521. echo     Saving services settings to
  522. echo       %SVC_BAK% ...
  523. "%regedit%" /e "%SVC_BAK%" HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services
  524. echo     Saving DCOM settings to
  525. echo       %DCOM_BAK% ...
  526. "%regedit%" /e "%DCOM_BAK%" HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Ole
  527. echo     Saving DCOM standard protocols settings to
  528. echo       %DCOMP_BAK% ...
  529. "%regedit%" /e "%DCOMP_BAK%" HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Rpc
  530. echo     Saving SMB settings to
  531. echo       %SMB_BAK%
  532. "%regedit%" /e "%SMB_BAK%" HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NetBT\Parameters
  533. echo     Saving URL-Handler [AIM, GOPHER, TELNET] to
  534. echo       %HANDLER1%
  535. "%regedit%" /e "%HANDLER1%" HKEY_CLASSES_ROOT\AIM
  536. echo       %HANDLER2%
  537. "%regedit%" /e "%HANDLER2%" HKEY_CLASSES_ROOT\gopher
  538. echo       %HANDLER3%
  539. "%regedit%" /e "%HANDLER3%" HKEY_CLASSES_ROOT\telnet
  540. echo.

  541. echo  All done.
  542. echo  ___________________________________________
  543. echo.


  544. :SKIP_SAVING

  545. if /I "%SYSTEM%"=="xp" (
  546.         if /I %UseXPSysRestore%==YES (
  547.                 goto :XPSYSRESTORE
  548.                 )
  549.         )
  550. :XPSYSRESTORE_DONE

  551. rem reconfigure services
  552. rem startup: demand
  553. echo.
  554. echo  Setting services to "demand" ...

  555. echo  ___________________________________________
  556. echo.
  557. echo  # Checking DHCP ...
  558. "%ipconfig%" -all | "%find%"  /i "Lease" > nul
  559. if errorlevel 1 (
  560.         rem trying other method for DHCP
  561.         "%ipconfig%" -all | "%find%"  /i "DHCP-Server" > nul
  562.         if errorlevel 1 (
  563.           echo                ... no active DHCP found.
  564.           echo.
  565.           echo  Hinweis
  566.           echo  =======
  567.           echo  Ihre Konfiguration deutet an, das kein DHCP benoetigt wird. Falls
  568.           echo  Sie dennoch einen DSL-Internetzugang besitzen und DHCP irrtuemlich
  569.           echo  deaktivert wurde, kann es nach einem Neustart zu Problemen mit der
  570.           echo  Internetverbindung kommen. Starten sie zur Problembehebung den
  571.           echo  DHCP-Dienst manuell neu.
  572.           echo.
  573.           echo  Notice
  574.           echo  ======
  575.           echo  Your configuration indicates that DHCP no longer will be required.
  576.           echo  But if you use a DSL internet connection this choice probably
  577.           echo  might be wrong. If you experiences problems during accessing the
  578.           echo  internet please re-activate the "DHCP Service" manually.
  579.           echo.
  580.           echo  ___________________________________________
  581.           echo.
  582.           "%sc%" config DHCP start= demand
  583.           goto :SKIP_DHCP
  584.         )
  585. )
  586. set DHCP_CHANGES="NO"
  587. echo  ... DHCP active, status of service will NOT be changed!
  588. echo.

  589. :SKIP_DHCP
  590. "%sc%" config dmadmin start= demand
  591. "%sc%" config DNSCache start= demand
  592. "%sc%" config mnmsrvc start= demand
  593. "%sc%" config MSIServer start= demand
  594. "%sc%" config NetDDE start= demand
  595. "%sc%" config NetDDEdsdm start= demand
  596. "%sc%" config Netman start= demand
  597. "%sc%" config NTLMSsp start= demand
  598. "%sc%" config NtmsSvc start= demand
  599. "%sc%" config PolicyAgent start= demand
  600. "%sc%" config RASAuto start= demand
  601. "%sc%" config RASMan start= demand
  602. "%sc%" config RSVP start= demand
  603. "%sc%" config Scardsvr start= demand

  604. "%sc%" query ScardDrv | "%find%"  /i "OpenService FAILED" >NUL
  605. if errorlevel 1 "%sc%" config ScardDrv start= demand

  606. if /I %XPSP2%==True (
  607.         rem If XP SP2 is installed there are less changes to XP-ICF
  608.         if /I %SELECT%=="/std" goto :SKIP_FIREWALL
  609.         )
  610. "%sc%" config SharedAccess start= demand

  611. :SKIP_FIREWALL
  612. "%sc%" config Sysmonlog start= demand
  613. "%sc%" config TAPISrv start= demand
  614. "%sc%" config TrkWks start= demand
  615. "%sc%" config UPS start= demand
  616. "%sc%" config W32Time start= demand
  617. "%sc%" config WMI start= demand

  618. if /I %SELECT%=="/all" (
  619.         "%sc%" config SamSs start= demand
  620.         "%sc%" config LmHosts start= demand
  621.         "%sc%" config Winmgmt start= demand
  622.         )

  623. if /I "%SYSTEM%"=="2k" (
  624.         "%sc%" config AppMgmt start= demand
  625.         "%sc%" config Browser start= demand
  626.         "%sc%" config clipsrv start= demand
  627.         "%sc%" config EventSystem start= demand
  628.         "%sc%" config Fax start= demand
  629.         "%sc%" config netlogon start= demand
  630.         "%sc%" config RPCLocator start= demand
  631.         "%sc%" config Utilman start= demand
  632.         if /I %SELECT%=="/all" (
  633.                 "%sc%" config seclogon start= demand
  634.                 "%sc%" config RPCSs start= demand
  635.                 "%sc%" config lanmanServer start= demand
  636.                 )
  637.         )


  638. if /I "%SYSTEM%"=="xp" (
  639.         "%sc%" config ALG start= demand
  640.         "%sc%" config FastUserSwitchingCompatibility start= demand
  641.         "%sc%" config helpsvc start= demand
  642.         "%sc%" config ImapiService start= demand
  643.         "%sc%" config Nla start= demand
  644.         "%sc%" config RdSessMgr start= demand
  645.         "%sc%" config seclogon start= demand
  646.         "%sc%" config stisvc start= demand
  647.         "%sc%" config SwPrv start= demand
  648.         "%sc%" config TermService start= demand
  649.         "%sc%" config upnphost start= demand
  650.         "%sc%" config VSS start= demand

  651.         "%sc%" query WmdmPmSp | "%find%"  /i "OpenService FAILED" >NUL
  652.         if errorlevel 1 "%sc%" config WmdmPmSp start= demand

  653.         "%sc%" config WmiApSrv start= demand
  654.         rem Wireless Zero Configuration - fuer WLAN-Verbindungen notwendig.
  655.         rem Falls erforderlich auf AUTO stellen.
  656.         rem "%sc%" config WZCSVC start= demand
  657.         )
  658. echo.




  659. rem startup: auto
  660. echo  Setting services to "auto" ...
  661. "%sc%" config dmserver start= auto
  662. "%sc%" config eventlog start= auto
  663. "%sc%" config PlugPlay start= auto
  664. "%sc%" config ProtectedStorage start= auto
  665. "%sc%" config sens start= auto
  666. "%sc%" config spooler start= auto

  667. if /I "%SYSTEM%"=="2k" (
  668.         "%sc%" config lanmanworkstation start= auto
  669.         "%sc%" config alerter start= auto
  670.         )

  671. if /I "%SYSTEM%"=="xp" (
  672.         "%sc%" query InteractiveLogon | "%find%"  /i "OpenService FAILED" >NUL
  673.         if errorlevel 1 "%sc%" config InteractiveLogon start= auto
  674.         "%sc%" config Audiosrv start= auto
  675.         "%sc%" config CryptSvc start= auto
  676.         "%sc%" config RPCSs start= auto
  677.         "%sc%" config ShellHWDetection start= auto
  678.         "%sc%" config srservice start= auto
  679.         "%sc%" query uploadmgr | "%find%"  /i "OpenService FAILED" >NUL
  680.         if errorlevel 1 "%sc%" config uploadmgr start= auto
  681.         "%sc%" config WebClient start= auto
  682.         )
  683. echo.





  684. rem startup: disabled
  685. echo  Setting services to "disabled" ...
  686. "%sc%" config cisvc start= disabled
  687. "%sc%" config MSDTC start= disabled
  688. "%sc%" config RemoteAccess start= disabled
  689. "%sc%" config TlntSvr start= disabled
  690. "%sc%" config messenger start= disabled


  691. if /I %SELECT%=="/all" (
  692.         "%sc%" query BITS | "%find%"  /i "SERVICE_NAME" >NUL
  693.         if not errorlevel 1 "%sc%" config BITS start= disabled
  694.         "%sc%" query wuauserv | "%find%"  /i "SERVICE_NAME" >NUL
  695.         if not errorlevel 1 "%sc%" config wuauserv start= disabled
  696.         "%sc%" config schedule start= disabled
  697.         "%sc%" config RemoteRegistry start= disabled
  698.         )

  699. if /I "%SYSTEM%"=="xp" (
  700.         "%sc%" config ERSvc start= disabled
  701.         "%sc%" config HidServ start= disabled
  702.         "%sc%" config SSDPSRV start= disabled

  703.         if /I %SELECT%=="/lan" (
  704.                 if /I %SCHEDULER_ENABLED%==NO "%sc%" config schedule start= disabled
  705.                 )

  706.         if /I %SELECT%=="/std" (
  707.                 if /I %SCHEDULER_ENABLED%==NO "%sc%" config schedule start= disabled
  708.                 )

  709.         if /I %XPSP2%==True (
  710.                 echo.
  711.                 echo  XPSP2: Disabling Security Center ...
  712.                 "%sc%" config wscsvc start= disabled
  713.                 )
  714.         )


  715. echo.
  716. echo  ------------------
  717. echo  # Checking and stopping unnecessary system services ...
  718. echo.
  719. "%sc%" query cisvc | "%find%"  /i "4  RUNNING" >NUL
  720.         if not errorlevel 1 "%net%" stop cisvc
  721. "%sc%" query RemoteAccess | "%find%"  /i "4  RUNNING" >NUL
  722.         if not errorlevel 1 "%net%" stop RemoteAccess
  723. "%sc%" query TlntSvr | "%find%"  /i "4  RUNNING" >NUL
  724.         if not errorlevel 1 "%net%" stop TlntSvr
  725. "%sc%" query MSDTC | "%find%"  /i "4  RUNNING" >NUL
  726.         if not errorlevel 1 "%net%" stop MSDTC
  727. "%sc%" query messenger | "%find%"  /i "4  RUNNING" >NUL
  728.         if not errorlevel 1 "%net%" stop messenger

  729. if /I %SELECT%=="/all" (
  730.         "%sc%" query BITS | "%find%"  /i "SERVICE_NAME" >NUL
  731.         if not errorlevel 1 (
  732.                 "%sc%" query BITS | "%find%"  /i "4  RUNNING" >NUL
  733.                 if not errorlevel 1 "%net%" stop BITS
  734.                 )
  735.         "%sc%" query wuauserv | "%find%"  /i "SERVICE_NAME" >NUL
  736.         if not errorlevel 1 (
  737.                 "%sc%" query wuauserv | "%find%"  /i "4  RUNNING" >NUL
  738.                 if not errorlevel 1 "%net%" stop wuauserv
  739.                 )
  740.         "%sc%" query schedule | "%find%"  /i "4  RUNNING" >NUL
  741.         if not errorlevel 1 "%net%" stop schedule
  742.         )

  743. if /I "%SYSTEM%"=="xp" (
  744.         if /I %SELECT%=="/lan" (
  745.                 if /I %SCHEDULER_ENABLED%==NO "%net%" (
  746.                         "%sc%" query schedule | "%find%"  /i "4  RUNNING" >NUL
  747.                         if not errorlevel 1 "%net%" stop schedule
  748.                         )
  749.                 )

  750.         if /I %SELECT%=="/std" (
  751.                 if /I %SCHEDULER_ENABLED%==NO "%net%" (
  752.                         "%sc%" query schedule | "%find%"  /i "4  RUNNING" >NUL
  753.                         if not errorlevel 1 "%net%" stop schedule
  754.                 )

  755.         if /I %XPSP2%==True (
  756.                 "%sc%" query wscsvc | "%find%"  /i "4  RUNNING" >NUL
  757.                 if not errorlevel 1 "%net%" stop wscsvc
  758.                 )

  759.         )

  760. echo  ------------------
  761. echo  Disabling DCOM ...
  762. echo REGEDIT4 > "%DCOM_TMP%"
  763. echo. >> "%DCOM_TMP%"
  764. echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Ole] >> "%DCOM_TMP%"
  765. echo "EnableDCOM"="N" >> "%DCOM_TMP%"
  766. echo "EnableDCOMHTTP"="N" >> "%DCOM_TMP%"
  767. echo. >> "%DCOM_TMP%"
  768. echo. >> "%DCOM_TMP%"
  769. "%regedit%" /s "%DCOM_TMP%"
  770. del /F /Q "%DCOM_TMP%"

  771. echo  Disabling DCOM standard protocols ...
  772. echo REGEDIT4 > "%DCOMP_TMP%"
  773. echo. >> "%DCOMP_TMP%"
  774. echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Rpc] >> "%DCOMP_TMP%"
  775. echo "DCOM Protocols"=hex(7):00,00,00,00 >> "%DCOMP_TMP%"
  776. echo. >> "%DCOMP_TMP%"
  777. echo. >> "%DCOMP_TMP%"
  778. "%regedit%" /s "%DCOMP_TMP%"
  779. del /F /Q "%DCOMP_TMP%"

  780.    echo  Disabling port 135 (maybe 1025 too) ...
  781.    echo    - Removing RPC Client Protocols
  782.    echo REGEDIT4 > "%SMB_TMP%"
  783.    echo [-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Rpc\ClientProtocols] >> "%SMB_TMP%"
  784.    echo. >> "%SMB_TMP%"

  785.    if /I %SCHEDULER_ENABLED%==NO (
  786.     echo    - Advanced RPC Configuration
  787.     echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Rpc\Internet] >> "%SMB_TMP%"
  788.     echo "PortsInternetAvailable"="N" >> "%SMB_TMP%"
  789.     echo "UseInternetPorts"="N" >> "%SMB_TMP%"
  790.     echo. >> "%SMB_TMP%"
  791.     )

  792.    if /I %XPSP2%==TRUE (
  793.     echo    - Advanced RPC Configuration
  794.     echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Rpc\Internet] >> "%SMB_TMP%"
  795.     echo "PortsInternetAvailable"="N" >> "%SMB_TMP%"
  796.     echo "UseInternetPorts"="N" >> "%SMB_TMP%"
  797.     echo. >> "%SMB_TMP%"
  798.     )

  799.    echo    - Removing needless URL Handler [AIM,gopher,telnet]
  800.    echo [-HKEY_CLASSES_ROOT\AIM] >> "%SMB_TMP%"
  801.    echo [-HKEY_CLASSES_ROOT\gopher] >> "%SMB_TMP%"
  802.    echo [-HKEY_CLASSES_ROOT\telnet] >> "%SMB_TMP%"
  803.    echo. >> "%SMB_TMP%"
  804.    echo. >> "%SMB_TMP%"
  805.   "%regedit%" /s "%SMB_TMP%"
  806.   del /F /Q "%SMB_TMP%"

  807. if /I %SELECT%=="/all" (
  808.         echo.
  809.         echo  Disabling SMB port 445 ...
  810.         echo REGEDIT4 > "%SMB_TMP%"
  811.         echo. >> "%SMB_TMP%"
  812.         echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NetBT\Parameters] >> "%SMB_TMP%"
  813.         echo "SMBDeviceEnabled"=dword:00000000 >> "%SMB_TMP%"
  814.         echo. >> "%SMB_TMP%"
  815.         echo. >> "%SMB_TMP%"
  816.         "%regedit%" /s "%SMB_TMP%"
  817.         del /F /Q "%SMB_TMP%"
  818.         set REBOOT_REQUIRED=yes
  819.         )

  820. if /I %SELECT%=="/std" (
  821.         echo.
  822.         echo  Disabling SMB port 445 ...
  823.         echo REGEDIT4 > "%SMB_TMP%"
  824.         echo. >> "%SMB_TMP%"
  825.         echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NetBT\Parameters] >> "%SMB_TMP%"
  826.         echo "SMBDeviceEnabled"=dword:00000000 >> "%SMB_TMP%"
  827.         echo. >> "%SMB_TMP%"
  828.         echo. >> "%SMB_TMP%"
  829.         "%regedit%" /s "%SMB_TMP%"
  830.         del /F /Q "%SMB_TMP%"
  831.         set REBOOT_REQUIRED=yes
  832.         )

  833. if /I %SELECT%=="/std" goto :NB_DISABLE
  834. if /I %SELECT%=="/all" goto :NB_DISABLE
  835. goto :SKIP_NB_DISABLE

  836. :NB_DISABLE
  837.   if /I %DEACTIVATE_NETBIOS%==NO (
  838.                 echo.
  839.                 echo.  Due problems with SP2 and deactivating NetBIOS this option
  840.                 echo   will be skipped.
  841.                 echo.
  842.                 goto :SKIP_NB_DISABLE
  843.                 )

  844.   rem Because of problems with SP2 Netbios:
  845.   if /I %XPSP2%==True (
  846.                 echo.
  847.                 echo  Note:
  848.                 echo  -----
  849.                 echo  If you experiencing problems after updating Windows XP with
  850.                 echo  Service Pack 2 please do following:
  851.                 echo.
  852.                 echo                          set Deactivate_NetBIOS=NO
  853.                 echo.
  854.                 )
  855.   rem *** Thx2 Johannes Lichtenberger for the following lines using VBScript***
  856.   echo  Disable NetBios on all local interfaces ...
  857.   echo.
  858.   echo On Error Resume Next>> "%nb_tmp%"
  859.   echo.>> "%nb_tmp%"
  860.   echo TcpipoverNetbios = 2 '0=NetbiosfromDHCP 1=EnableNetbios 2=DisableNetbios>> "%nb_tmp%"
  861.   echo.>> "%nb_tmp%"
  862.   echo strComputer = ".">> "%nb_tmp%"
  863.   echo Set objWMIService = GetObject("winmgmts:\" ^& strComputer ^& "\root\cimv2")>> "%nb_tmp%"
  864.   echo Set objNICs = objWMIService.ExecQuery _>> "%nb_tmp%"
  865.   echo    ("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True")>> "%nb_tmp%"
  866.   echo For Each objNic In objNICs>> "%nb_tmp%"
  867.   echo    errTcpipNetbios = objNic.SetTCPIPNetBIOS(TcpipoverNetbios)>> "%nb_tmp%"
  868.   echo Next>> "%nb_tmp%"
  869.   "%SYSTEMROOT%\SYSTEM32\CSCRIPT.EXE" "%nb_tmp%"
  870.   del /F /Q "%nb_tmp%"
  871.   set REBOOT_REQUIRED=yes

  872. :SKIP_NB_DISABLE
  873. rem Skip Billboard because /all is used
  874. if /I %SELECT%=="/all" goto :SW_ALL
  875. if /I %SELECT%=="/std" goto :SW_ALL
  876. if /I %SELECT%=="/relan" goto :SW_ALL
  877. echo.
  878. echo  ___________________________________________________________________
  879. echo.
  880. echo                   *** Zusammenfassung / Result ***
  881. echo.
  882. echo  Es wurden NICHT alle Aenderungen umgesetzt!
  883. echo  Um alle Vorschlaege von kssysteme.de umzusetzen, verwenden Sie
  884. echo  bitte den Parameter '/all' oder waehlen Sie im Menue den Punkt "3".
  885. if /I %DHCP_CHANGES%=="YES" (
  886.                  echo.
  887.                   echo  Wichtiger DHCP Hinweis
  888.                   echo  ======================
  889.                   echo  Ihre Konfiguration deutete an, das kein DHCP benoetigt wird. Falls
  890.                   echo  Sie jedoch einen DSL-Internetzugang besitzen und DHCP irrtuemlich
  891.                   echo  deaktivert wurde, kann es nach einem Neustart zu Problemen mit der
  892.                   echo  Internetverbindung kommen. Starten sie zur Problembehebung den
  893.                   echo  DHCP-Dienst von Hand neu.
  894.                   echo.
  895.                 )

  896. echo.
  897. echo  Not all changes could be performed. To change all issues listed
  898. echo  on www.ntsvcfg.de please use parameter '/all' or select item "3"!
  899. if /I %DHCP_CHANGES%=="YES" (
  900.                  echo.
  901.                   echo  Important DHCP Notice
  902.                   echo  =====================
  903.                   echo  Your configuration indicates that DHCP will no longer be required.
  904.                   echo  But if you are using a DSL internet connection this choice probably
  905.                   echo  might be wrong. If you experiences problems during accessing the
  906.                   echo  internet please re-activate the "DHCP Service" manually.
  907.                 echo.
  908.                 )
  909. echo  ___________________________________________________________________

  910. :SW_ALL

  911. if /I %SELECT%=="/relan" (
  912.         rem startup: auto
  913.         echo.
  914.         echo  ------------------
  915.         echo  Re-enabling services ...
  916.         "%sc%" config LmHosts  start= auto
  917.         "%sc%" config RemoteRegistry start= auto
  918.         "%sc%" config SamSs start= auto
  919.         "%sc%" config Winmgmt start= auto
  920.         if /I "%SYSTEM%"=="2k" (
  921.                 "%sc%" config RPCSs start= auto
  922.                 "%sc%" config lanmanServer start= auto
  923.                 "%sc%" config seclogon start= auto
  924.                 )
  925.         if /I "%SYSTEM%"=="XP" (
  926.                 rem "%sc%" config SharedAccess start= auto
  927.                 )


  928.         rem start re-enabled services
  929.         echo.
  930.         echo  ------------------
  931.         echo  [Re]starting services ...
  932.         echo.

  933.         "%sc%" query RemoteRegistry | "%find%"  /i "1  STOPPED" >NUL
  934.         if not errorlevel 1 "%net%" start RemoteRegistry
  935.         "%sc%" query SamSs | "%find%"  /i "1  STOPPED" >NUL
  936.         if not errorlevel 1 "%net%" start SamSs
  937.         "%sc%" query LmHosts | "%find%"  /i "1  STOPPED" >NUL
  938.         if not errorlevel 1 "%net%" start LmHosts
  939.         "%sc%" query Winmgmt | "%find%"  /i "1  STOPPED" >NUL
  940.         if not errorlevel 1 "%net%" start Winmgmt
  941.         if /I "%SYSTEM%"=="2k" (
  942.                 "%sc%" query LanmanServer | "%find%"  /i "1  STOPPED" >NUL
  943.                 if not errorlevel 1 "%net%" start lanmanServer
  944.                 "%sc%" query RPCSs | "%find%"  /i "1  STOPPED" >NUL
  945.                 if not errorlevel 1 "%net%" start RPCSs
  946.                 "%sc%" query Seclogon | "%find%"  /i "1  STOPPED" >NUL
  947.                 if not errorlevel 1 "%net%" start seclogon
  948.                 )

  949.         if /I "%SYSTEM%"=="XP" (
  950.                 rem "%net%" start SharedAccess
  951.                 )

  952.         rem enable SMB port 445
  953.         echo.
  954.         echo  ------------------
  955.         echo  Enabling SMB port 445 ...
  956.         echo REGEDIT4 > "%SMB_TMP%"
  957.         echo. >> "%SMB_TMP%"
  958.         echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NetBT\Parameters] >> "%SMB_TMP%"
  959.         echo "SMBDeviceEnabled"=dword:00000001 >> "%SMB_TMP%"
  960.         echo. >> "%SMB_TMP%"
  961.         echo. >> "%SMB_TMP%"
  962.         "%regedit%" /s "%SMB_TMP%"
  963.         del /F /Q "%SMB_TMP%"
  964.         set REBOOT_REQUIRED=yes
  965.         )


  966. rem Creating fingerprint of current service settings...
  967. if exist "%FPRINT%" del /F /Q "%FPRINT%"
  968. if /I %USE_FPRINT%==YES (
  969.         echo.
  970.         echo  Creating fingerprint which will take a few seconds ...
  971.         "%sc%" query type= service state= all bufsize= 8192 | %FIND% "SERVICE_NAME" > %TEMP%\~svclist.txt
  972.         for /F "tokens=1*" %%a in (%TEMP%\~svclist.txt) do (
  973.                 echo %%b >>"%FPRINT%"
  974.                 "%sc%" query "%%b" | %FIND% "STATE" >>"%FPRINT%"
  975.                 "%sc%" qc "%%b" | %FIND% "DISPLAY_NAME" >>"%FPRINT%"
  976.                 "%SC%" qc "%%b" | %FIND% "START_TYPE" >>"%FPRINT%"
  977.                 echo. >> "%FPRINT%"
  978.                 )
  979.         del "%TEMP%\~svclist.txt"
  980.         echo                                                      ... done.
  981.         )
  982. goto :END


  983. :RESTORE
  984. echo  ____________________________________________________
  985. echo.
  986. echo  Letzte Aenderungen zuruecknehmen [y/n]?
  987. set /P UNDO= Undo last changes [y/n]?
  988. if /I "%UNDO%"=="y" (
  989.         echo  _______________________________________________________________
  990.         echo.
  991.         echo  Hinweis:
  992.         echo  ========
  993.         echo  Moeglicherweise meldet Windows Fehler beim Importieren.
  994.         echo  Ignorieren Sie diese mit Klick auf "OK".
  995.         echo.
  996.         echo  Windows might probably report an error during importing the
  997.         echo  backups. Just ignore this by clicking the "OK" button!
  998.         echo  _______________________________________________________________
  999.         echo  Status:
  1000.         echo  -------
  1001.         :RESTORE_EXT
  1002.         if exist "%SVC_BAK%" (
  1003.                 echo     Importing services ...
  1004.                 echo        ["%SVC_BAK%"]
  1005.                 "%regedit%" /s "%SVC_BAK%"
  1006.                 set action=""
  1007.                 )

  1008.         if exist "%DCOM_BAK%" (
  1009.                 echo     Importing DCOM ...
  1010.                 echo        ["%DCOM_BAK%"]
  1011.                 "%regedit%" /s "%DCOM_BAK%"
  1012.                 )

  1013.         if exist "%DCOMP_BAK%" (
  1014.                 echo     Importing DCOM-standard protocols ...
  1015.                 echo        ["%DCOMP_BAK%"]
  1016.                 "%regedit%" /s "%DCOMP_BAK%"
  1017.                 )

  1018.         if exist "%SMB_BAK%" (
  1019.                 echo     Importing SMB-settings ...
  1020.                 echo        ["%SMB_BAK%"]
  1021.                 echo   - Removing SMBDeviceEnabled RegKey ...
  1022.                 echo REGEDIT4 > "%USERPROFILE%\smbpatch~.reg"
  1023.                 echo. >> "%USERPROFILE%\smbpatch~.reg"
  1024.                 echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NetBT\Parameters] >> "%USERPROFILE%\smbpatch~.reg"
  1025.                 echo "SMBDeviceEnabled"=- >> "%USERPROFILE%\smbpatch~.reg"
  1026.                 echo. >> "%USERPROFILE%\smbpatch~.reg"
  1027.                 echo. >> "%USERPROFILE%\smbpatch~.reg"
  1028.                 "%SystemRoot%\regedit.exe" /s "%USERPROFILE%\smbpatch~.reg"
  1029.                 del /F /Q "%USERPROFILE%\smbpatch~.reg"
  1030.                 "%regedit%" /s "%SMB_BAK%"
  1031.                 )

  1032.         if exist "%HANDLER1%" (
  1033.                 echo     Importing URL_HANDLER AIM ...
  1034.                 echo        ["%HANDLER1%"]
  1035.                 "%regedit%" /s "%HANDLER1%"
  1036.                 )

  1037.         if exist "%HANDLER2%" (
  1038.                 echo     Importing URL_HANDLER GOPHER ...
  1039.                 echo        ["%HANDLER2%"]
  1040.                 "%regedit%" /s "%HANDLER2%"
  1041.                 )

  1042.         if exist "%HANDLER3%" (
  1043.                 echo     Importing URL_HANDLER TELNET ...
  1044.                 echo        ["%HANDLER3%"]
  1045.                 "%regedit%" /s "%HANDLER3%"
  1046.                 )

  1047.         rem Skipping back to next state
  1048.         if /I "%RESTORE%"=="YES" goto :NO_RESTORE

  1049.         echo     Removing RPC Internet key ....
  1050.         echo REGEDIT4 >"%USERPROFILE%\svc_fix.reg"
  1051.         echo. >>"%USERPROFILE%\svc_fix.reg"
  1052.         echo [-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Rpc\Internet] >>"%USERPROFILE%\svc_fix.reg"
  1053.         echo. >>"%USERPROFILE%\svc_fix.reg"
  1054.         echo. >>"%USERPROFILE%\svc_fix.reg"
  1055.         "%regedit%" /s "%USERPROFILE%\svc_fix.reg"
  1056.         del /F /Q "%USERPROFILE%\svc_fix.reg"

  1057.         rem Creating fingerprint of current service settings...
  1058.         if exist "%FPRINT%" del /F /Q "%FPRINT%"
  1059.         if /I %USE_FPRINT%==YES (
  1060.                 echo.
  1061.                 echo  Creating fingerprint which will take a few seconds ...
  1062.                 "%sc%" query type= service state= all bufsize= 8192 | %FIND% "SERVICE_NAME" > %TEMP%\~svclist.txt
  1063.                 for /F "tokens=1*" %%a in (%TEMP%\~svclist.txt) do (
  1064.                         echo %%b >>"%FPRINT%"
  1065.                         "%sc%" query "%%b" | %FIND% "STATE" >>"%FPRINT%"
  1066.                         "%sc%" qc "%%b" | %FIND% "DISPLAY_NAME" >>"%FPRINT%"
  1067.                         "%SC%" qc "%%b" | %FIND% "START_TYPE" >>"%FPRINT%"
  1068.                         echo. >> "%FPRINT%"
  1069.                         )
  1070.                 del "%TEMP%\~svclist.txt"
  1071.                 echo                                                      ... done.
  1072.                 )

  1073.         echo.
  1074.         echo  _______________________________________________________________
  1075.         echo.
  1076.         echo               *** Zusammenfassung / Result ***
  1077.         echo.
  1078.         echo  Die Ruecksicherung wurde ausgefuehrt. Wenn in der oberen Zeile
  1079.         echo  keine Statusmeldungen zu sehen sind, existierten keine rueckzu-
  1080.         echo  sichernden Dateien. Aktivieren Sie gegebenenfalls NetBios in
  1081.         echo  den Eigenschaften der jeweiligen Netzwerkkarte.
  1082.         echo  Bitte starten Sie abschliessend Ihren Rechner neu.
  1083.         echo.
  1084.         echo  Restore finished. If you don't see any messages in the status
  1085.         echo  box above, there were no files to restore. Please reactivate
  1086.         echo  NetBios for each NIC you want use with it and reboot afterwards.
  1087.         echo  ________________________________________________________________
  1088.         )

  1089. goto :END

  1090. :RESTORE_DEFAULTS
  1091. echo.
  1092. echo                     *** Restore Factory Settings ***
  1093. echo.
  1094. echo  ______________________________________________________________________________
  1095. echo.
  1096. echo  Einstellungen vor Erstanwendung des Scripts wiederherstellen (ausser NetBIOS)?
  1097. set /P UNDO= Restore defaults (before using script, except NetBIOS) [y/n]?
  1098. if /I "%UNDO%"=="y" (
  1099.         echo.
  1100.         echo   - Restoring original service settings [if exists] ...

  1101.         if exist "%SVC_BAK%.default"         (
  1102.                                         echo      "%SVC_BAK%.default"
  1103.                                         "%regedit%" /s "%SVC_BAK%.default"
  1104.                                         )
  1105.         if exist "%DCOM_BAK%.default"         (
  1106.                                         echo      "%DCOM_BAK%.default"
  1107.                                         "%regedit%" /s "%DCOM_BAK%.default"
  1108.                                         )
  1109.         if exist "%DCOMP_BAK%.default"         (
  1110.                                         echo      "%DCOMP_BAK%.default"
  1111.                                         "%regedit%" /s "%DCOMP_BAK%.default"
  1112.                                         )
  1113.         if exist "%SMB_BAK%.default"        (
  1114.                                         echo      "%SMB_BAK%.default"
  1115.                                         echo   - Removing SMBDeviceEnabled RegKey ...
  1116.                                         echo REGEDIT4 > "%USERPROFILE%\smbpatch~.reg"
  1117.                                         echo. >> "%USERPROFILE%\smbpatch~.reg"
  1118.                                         echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NetBT\Parameters] >> "%USERPROFILE%\smbpatch~.reg"
  1119.                                         echo "SMBDeviceEnabled"=- >> "%USERPROFILE%\smbpatch~.reg"
  1120.                                         echo. >> "%USERPROFILE%\smbpatch~.reg"
  1121.                                         echo. >> "%USERPROFILE%\smbpatch~.reg"
  1122.                                         "%SystemRoot%\regedit.exe" /s "%USERPROFILE%\smbpatch~.reg"
  1123.                                         del /F /Q "%USERPROFILE%\smbpatch~.reg"
  1124.                                         "%regedit%" /s "%SMB_BAK%.default"
  1125.                                         )
  1126.         if exist "%HANDLER1%.default"         (
  1127.                                         echo      "%HANDLER1%.default"
  1128.                                         "%regedit%" /s "%HANDLER1%.default"
  1129.                                         )
  1130.         if exist "%HANDLER2%.default"         (
  1131.                                         echo           "%HANDLER2%.default"
  1132.                                         "%regedit%" /s "%HANDLER2%.default"
  1133.                                         )
  1134.         if exist "%HANDLER3%.default"         (
  1135.                                         echo "%HANDLER3%.default"
  1136.                                         "%regedit%" /s "%HANDLER3%.default"
  1137.                                         )
  1138.         echo                                                 ... done.

  1139.         echo   - Removing RPC Internet key ...
  1140.         echo REGEDIT4 >"%USERPROFILE%\svc_fix.reg"
  1141.         echo. >>"%USERPROFILE%\svc_fix.reg"
  1142.         echo [-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Rpc\Internet] >>"%USERPROFILE%\svc_fix.reg"
  1143.         echo. >>"%USERPROFILE%\svc_fix.reg"
  1144.         echo. >>"%USERPROFILE%\svc_fix.reg"
  1145.         "%regedit%" /s "%USERPROFILE%\svc_fix.reg"
  1146.         del /F /Q "%USERPROFILE%\svc_fix.reg"
  1147.         echo                                                 ... done.

  1148.         )
  1149. goto :QUIT


  1150. :SC_DOWNLOAD
  1151. echo  ______________________________________________________________
  1152. echo.
  1153. echo  Besteht eine aktive Internetverbindung?
  1154. echo  Are you currently connected to the internet?
  1155. echo.
  1156. set /P UNDO= Bitte waehlen/Please choose: [y/n]?
  1157.   if /I "%UNDO%"=="y" goto :SC_DOWNLOAD_OK
  1158. goto :END

  1159. :SC_DOWNLOAD_OK
  1160. if exist "%SYSTEMROOT%\sc.zip" goto :SCE
  1161. echo  Generating FTP-script ...
  1162. if exist "%USERPROFILE%"\script_sc.ls del /F "%USERPROFILE%\script_sc.ls"
  1163. echo open 207.46.133.140 >"%USERPROFILE%\script_sc.ls"
  1164. echo user anonymous anonymous@aol.com >>"%USERPROFILE%\script_sc.ls"
  1165. echo type binary >>"%USERPROFILE%\script_sc.ls"
  1166. echo user anonymous anonymous@aol.com >>"%USERPROFILE%\script_sc.ls"
  1167. echo type binary >>"%USERPROFILE%\script_sc.ls"
  1168. echo get /reskit/win2000/sc.zip "%SYSTEMROOT%\System32\SC.ZIP" >>"%USERPROFILE%\script_sc.ls"
  1169. echo quit >>"%USERPROFILE%\script_sc.ls"

  1170. echo  Downloading SC.EXE ...
  1171. ftp -s:"%USERPROFILE%\script_sc.ls"
  1172. del /F "%USERPROFILE%\script_sc.ls"

  1173. :SCE
  1174. if exist "%SYSTEMROOT%\System32\pkunzip.exe" goto :PKE
  1175. echo  Generating FTP-script ...
  1176. if exist "%USERPROFILE%"\script_pk.ls del /F "%USERPROFILE%\script_pk.ls"
  1177. echo open ftp.uni-duesseldorf.de >"%USERPROFILE%\script_pk.ls"
  1178. echo user anonymous anonymous@aol.com >>"%USERPROFILE%\script_pk.ls"
  1179. echo type binary >>"%USERPROFILE%\script_pk.ls"
  1180. echo user anonymous anonymous@aol.com >>"%USERPROFILE%\script_pk.ls"
  1181. echo type binary >>"%USERPROFILE%\script_pk.ls"
  1182. echo get /pub/ie/pkunzip.exe "%SYSTEMROOT%\System32\pkunzip.exe" >>"%USERPROFILE%\script_pk.ls"
  1183. echo quit >>"%USERPROFILE%\script_pk.ls"

  1184. echo  Downloading PKUNZIP.EXE ...
  1185. ftp -s:"%USERPROFILE%\script_pk.ls"
  1186. del /F "%USERPROFILE%\script_pk.ls"

  1187. :PKE
  1188. if not exist "%SYSTEMROOT%\System32\sc.zip" (
  1189.         echo.
  1190.         echo   Download fehlgeschlagen. Bitte laden sie sich die Datei SC.ZIP manuell
  1191.         echo   herunter und kopieren diese nach %SYSTEMROOT%\.
  1192.         echo.
  1193.         echo   Downloading SC.ZIP failed. Please download it manually an copy it to
  1194.         echo   %SYSTEMROOT%\.
  1195.         )

  1196. if not exist "%SYSTEMROOT%\System32\pkunzip.exe" (
  1197.         echo.
  1198.         echo   Die Datei PKUNZIP.EXE konnte nicht gefunden werden. Diese wird zum
  1199.         echo   Entpacken des Archivs SC.ZIP benoetigt!
  1200.         echo.
  1201.         echo   File PKUNZIP.EXE not found. It is needed to decompress the archive SC.EXE.
  1202.         )

  1203. if exist "%SYSTEMROOT%\System32\SC.ZIP" (
  1204.         if exist "%SYSTEMROOT%\System32\pkunzip.exe" (
  1205.                 "%SYSTEMROOT%\System32\pkunzip.exe" -e "%SYSTEMROOT%\System32\sc.zip" sc.exe
  1206.                 )
  1207.         )

  1208. move /Y sc.exe "%SYSTEMROOT%\System32"
  1209. echo.
  1210. echo  Skript wird neu gestartet ...
  1211. echo  Restarting script ...
  1212. goto :START

  1213. :FIX
  1214. echo.
  1215. echo                     -= svc2kxp.cmd taskplaner fix =-
  1216. echo.
  1217. echo.
  1218. echo  Druecken Sie "Y", um das Problem mit dem Taskplaner ("falscher Parameter")
  1219. echo  unter Windows XP zu beheben.
  1220. echo.
  1221. echo  Press "Y", if you want fix issue "scheduler doesn't start under Windows XP
  1222. echo  after running script v2.0 - v2.1build0".
  1223. echo.
  1224. set /P UNDO= Fix problem [y/n]?
  1225. if /I "%UNDO%"=="y" (
  1226.         echo REGEDIT4 >"%USERPROFILE%\svc_fix.reg"
  1227.         echo. >>"%USERPROFILE%\svc_fix.reg"
  1228.         echo [-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Rpc\Internet] >>"%USERPROFILE%\svc_fix.reg"
  1229.         echo. >>"%USERPROFILE%\svc_fix.reg"
  1230.         echo. >>"%USERPROFILE%\svc_fix.reg"
  1231.         "%regedit%" /s "%USERPROFILE%\svc_fix.reg"
  1232.         del /F /Q "%USERPROFILE%\svc_fix.reg"
  1233.         echo  ______________________________________
  1234.         echo  OK. Bitte starten Sie den Rechner neu und kontrollieren Sie erneut,
  1235.         echo  ob hierdurch Ports geoeffnet wurden.
  1236.         echo.
  1237.         echo  Done. Please reboot and check again for open ports ...!
  1238.         )


  1239. rem Creating fingerprint of current service settings...
  1240. if exist "%FPRINT%" del /F /Q "%FPRINT%"
  1241. goto quit
  1242. if /I %USE_FPRINT%==YES (
  1243.         echo.
  1244.           echo  Creating fingerprint which will take a few seconds ...
  1245.           "%sc%" query type= service state= all bufsize= 8192 | %FIND% "SERVICE_NAME" > %TEMP%\~svclist.txt
  1246.           for /F "tokens=1*" %%a in (%TEMP%\~svclist.txt) do (
  1247.                 echo %%b >>"%FPRINT%"
  1248.                 "%sc%" query "%%b" | %FIND% "STATE" >>"%FPRINT%"
  1249.                 "%sc%" qc "%%b" | %FIND% "DISPLAY_NAME" >>"%FPRINT%"
  1250.                 "%SC%" qc "%%b" | %FIND% "START_TYPE" >>"%FPRINT%"
  1251.                 echo. >> "%FPRINT%"
  1252.                 )
  1253.         del "%TEMP%\~svclist.txt"
  1254.         echo                                                      ... done.
  1255.         )

  1256. goto :QUIT

  1257. rem **** Additional Feature List ****

  1258. :MORE_OPTIONS
  1259. cls
  1260. echo  ______________________________________________________________________________
  1261. echo.
  1262. echo                 *** Weitere Optionen / More Options Menue ***
  1263. echo                     =====================================
  1264. echo.
  1265. if /I "%SVC_MOD%"=="YES" (
  1266.         echo  [E]...Zeigt eine Liste an, welche Dienste seit der letzten Anwendung
  1267.         echo        von svc2kxp.cmd veraendert wurden.
  1268.         echo.
  1269.         echo        Shows a list with modified services since last use of scv2kxp.cmd
  1270.         echo.
  1271.         )

  1272. echo  [G]...Generiert einen neuen Fingerprint, um Veraenderungen bei
  1273. echo        Diensten zu erfassen
  1274. echo.
  1275. echo        Generates a new fingerprint to correctly detect changes of
  1276. echo        services
  1277. echo.
  1278. echo  [S]...Sichern der aktuellen Dienstekonfiguration.
  1279. echo        Saving current NT service configuration (auto/demand/disabled).
  1280. echo.
  1281. echo  ______________________________________________________________________________
  1282. echo.
  1283. if /I "%SVC_MOD%"=="NO" set /P CHS=       Bitte waehlen Sie/Please choose: [G], [S], [B]ack or [Q]uit?
  1284. if /I "%SVC_MOD%"=="YES" set /P CHS=       Bitte waehlen Sie/Please choose: [E], [G], [S], [B]ack or [Q]uit?
  1285. if /I "%SVC_MOD%"=="YES" if /I "%CHS%"=="E" GOTO :EVALUATE_SERVICES
  1286. if /I "%CHS%"=="G" GOTO :CREATING_NEW_FINGERPRINT
  1287. if /I "%CHS%"=="B" (
  1288.                     CLS
  1289.                     GOTO :START
  1290.                    )
  1291. if /I "%CHS%"=="S" GOTO :SAVE_SVC_SETTINGS
  1292. if /I "%CHS%"=="Q" GOTO :QUIT
  1293. GOTO :MORE_OPTIONS



  1294. :EVALUATE_SERVICES
  1295. cls
  1296. echo  ______________________________________________________________________________
  1297. echo.
  1298. echo                        *** Evaluate Services Menue ***
  1299. echo.
  1300. "%FC%" /N "%FPRINT%" "%USERPROFILE%\ntsvcfg\svc2cmp.sav"
  1301. echo  ______________________________________________________________________________
  1302. echo.
  1303. set /P CHS=       Bitte waehlen Sie/Please choose: [B]ack, [U]pdate or [Q]uit?
  1304. if /I "%CHS%"=="B" GOTO :MORE_OPTIONS
  1305. if /I "%CHS%"=="U" GOTO :CREATING_NEW_FINGERPRINT
  1306. if /I "%CHS%"=="Q" GOTO :QUIT
  1307. GOTO :MORE_OPTIONS


  1308. :SAVE_SVC_SETTINGS
  1309. cls
  1310. echo  ______________________________________________________________________________
  1311. echo.
  1312. echo               *** Manage current services configurations menue ***
  1313. echo                   --------------------------------------------
  1314. echo.
  1315. echo   Soll die aktuelle Dienstekonfiguration gesichert werden?
  1316. echo.
  1317. set /P CHS=  Should the current service configuration saved (y/n)?
  1318. if /I "%CHS%"=="N" GOTO :MORE_OPTIONS
  1319. if /I "%CHS%"=="Y" (
  1320.         echo   Saving current services settings to:
  1321.         echo.
  1322.         echo    - %SVC_SAV%
  1323.         "%regedit%" /e "%SVC_SAV%" HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services
  1324.         echo.
  1325.         echo   ... Done!
  1326.         echo  ______________________________________________________________________________
  1327.         echo.
  1328.         echo        Beliebige Taste druecken, um fortzufahren. Hit any key to return.
  1329.         pause>NUL
  1330.         )
  1331. if /I "%CHS%"=="Q" GOTO :QUIT
  1332. goto :MORE_OPTIONS




  1333. pause >NUL
  1334. goto :MORE_OPTIONS


  1335. :CREATING_NEW_FINGERPRINT
  1336. cls
  1337. echo  ______________________________________________________________________________
  1338. echo.
  1339. echo                     *** Creating new fingerprint menue ***
  1340. echo                         ------------------------------
  1341. echo.
  1342. set /P CHS=  Create new fingerprint [Y/N]?
  1343. if /I "%CHS%"=="Y" (
  1344.         if exist "%FPRINT%" del /F /Q "%FPRINT%"
  1345.         echo   Creating new fingerprint which will take a few seconds ...
  1346.         "%sc%" query type= service state= all bufsize= 8192 | %FIND% "SERVICE_NAME" > %TEMP%\~svclist.txt
  1347.         for /F "tokens=1*" %%a in (%TEMP%\~svclist.txt) do (
  1348.                 echo %%b >>"%FPRINT%"
  1349.                 "%sc%" query "%%b" | %FIND% "STATE" >>"%FPRINT%"
  1350.                 "%sc%" qc "%%b" | %FIND% "DISPLAY_NAME" >>"%FPRINT%"
  1351.                 "%SC%" qc "%%b" | %FIND% "START_TYPE" >>"%FPRINT%"
  1352.                 echo. >> "%FPRINT%"
  1353.                 )
  1354.         del "%TEMP%\~svclist.txt"
  1355.         echo                                                           ... done.
  1356.         echo  ______________________________________________________________________________
  1357.         echo.
  1358.         echo                          [Press any key to continue]
  1359.         set CHK_SVC=YES
  1360.         PAUSE >NUL
  1361.         )
  1362. cls
  1363. GOTO :MORE_OPTIONS


  1364. :XPSYSRESTORE
  1365. REM Creating A System Restore Point // Source Code: MS Technet Scriptcenter
  1366.         echo.
  1367.         echo  # Creating System Restore Point [if XP SysRestore is enabled] ...
  1368.         if exist "%srctmp%" del /F /Q "%srctmp%"
  1369.         echo CONST DEVICE_DRIVER_INSTALL = 10 >"%srctmp%"
  1370.         echo CONST BEGIN_SYSTEM_CHANGE = 100 >>"%srctmp%"
  1371.         echo.>>"%srctmp%"
  1372.         echo strComputer = ".">>"%srctmp%"
  1373.         echo Set objWMIService = GetObject("winmgmts:" _ >>"%srctmp%"
  1374.         echo         ^& "{impersonationLevel=impersonate}!\" ^& strComputer ^& "\root\default")>>"%srctmp%"
  1375.         echo.>>"%srctmp%"
  1376.         echo Set objItem = objWMIService.Get("SystemRestore")>>"%srctmp%"
  1377.         echo errResults = objItem.CreateRestorePoint _ >>"%srctmp%"
  1378.         echo         ("svc2kxp.cmd created restore point", DEVICE_DRIVER_INSTALL, BEGIN_SYSTEM_CHANGE)>>"%srctmp%"
  1379.         "%srctmp%"
  1380.         del /F /Q "%srctmp%"
  1381.         echo.
  1382. goto :XPSYSRESTORE_DONE


  1383. :END
  1384. if "%REBOOT_REQUIRED%"=="yes" (
  1385.         echo.
  1386.         echo  ______________________________________________________
  1387.         echo.
  1388.         echo           *** Zusammenfassung / Result ***
  1389.         echo.
  1390.         if /I %SELECT%=="/all" echo  Es wurden alle gewuenschten Aenderungen durchgefuehrt.
  1391.         if /I %SELECT%=="/std" echo  Einige Dienste blieben unveraendert.
  1392.         if /I %SELECT%=="/relan" echo  Notwendige LAN-Einstellungen wurden aktiviert.
  1393.         if /I %DHCP_CHANGES%=="YES" (
  1394.                  echo.
  1395.                   echo  Wichtiger DHCP Hinweis
  1396.                   echo  ======================
  1397.                   echo  Ihre Konfiguration deutete an, das kein DHCP benoetigt wird. Falls
  1398.                   echo  Sie jedoch einen DSL-Internetzugang besitzen und DHCP irrtuemlich
  1399.                   echo  deaktivert wurde, kann es nach einem Neustart zu Problemen mit der
  1400.                   echo  Internetverbindung kommen. Starten sie zur Problembehebung den
  1401.                   echo  DHCP-Dienst von Hand neu.
  1402.                   echo.
  1403.                 )
  1404.         echo.
  1405.         echo  Bitte starten Sie abschliessend Ihren Rechner neu.
  1406.         echo.
  1407.         if /I %SELECT%=="/all" echo  All changes applied successfully.
  1408.         if /I %SELECT%=="/std" echo  Some services stay unchanged.
  1409.         if /I %SELECT%=="/relan" echo  LAN settings reactivated.
  1410.         if /I %DHCP_CHANGES%=="YES" (
  1411.                  echo.
  1412.                   echo  Important DHCP Notice
  1413.                   echo  =====================
  1414.                   echo  Your configuration indicates that DHCP will no longer be required.
  1415.                   echo  But if you are using a DSL internet connection this choice probably
  1416.                   echo  might be wrong. If you experiences problems during accessing the
  1417.                   echo  internet please re-activate the "DHCP Service" manually.
  1418.                 echo.
  1419.                 )
  1420.         echo  Please reboot.
  1421.         echo  ______________________________________________________
  1422.         )


  1423. :QUIT
  1424. echo             ________________________________________________________
  1425. echo.
  1426. echo                     更多信息: http://www.Msnsm.Com
  1427. color 0B
  1428. ECHO.
  1429. ECHO.
  1430. ECHO.
  1431. ECHO.
  1432. ECHO.
  1433. ECHO.
  1434. ECHO.
  1435. ECHO.
  1436. ECHO.
  1437. ECHO.
  1438. ECHO.
  1439. ECHO.
  1440. ECHO                      ┌────────────────┐  
  1441. ECHO                      │▉▉▉ 已经成功的完成操作 ▉▉▉│
  1442. ECHO                      └────────────────┘


  1443. )
  1444. ECHO.
  1445. ECHO.
  1446. ECHO.
  1447. ECHO.
  1448. ECHO.
  1449. ECHO.
  1450. ECHO.
  1451. ECHO.
  1452. ECHO.
  1453. ECHO 按任意键退出......
  1454. if /I "%1"=="" pause>NUL

  1455. :QUIT_EXT
  1456. endlocal
  1457. if exist "%USERPROFILE%\ntsvcfg\svc2cmp.sav" del /F /Q "%USERPROFILE%\ntsvcfg\svc2cmp.sav"
  1458. echo.
复制代码
发表于 2012-1-31 22:21:09 | 显示全部楼层
你自己到虚拟机里面运行一下就知道了
发表于 2012-1-31 23:55:54 | 显示全部楼层
echo 占了代码行数的一半
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|批处理之家 ( 渝ICP备10000708号 )

GMT+8, 2026-3-18 16:48 , Processed in 0.026690 second(s), 8 queries , File On.

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表