『楼 主』:
[推荐]德国人写的系统服务优化P处理
我大致翻译了下,其实思路很简单 就是sc的应用,欣赏的只是他的效率/效果
欢迎大家讨论.
修改请注意软件作者的版权.....
突然发现不能传附件,那只好把代码贴出来咯....庞大啊!!
@echo off
cls
color 0a
rem Copyright (C) 2003-05 Ansgar Wiechers & Torsten Mann
rem Contact: admin@ntsvcfg.de
rem 汉化:Robust QQ: 9704177
rem This program is free software; you can redistribute it and/or modify it under
rem 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.
rem
rem 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.
setlocal
echo 本地化操作环境…
echo 本地化操作环境成功!
REM *** INIT_VARS ***
set CHK_SVC=YES
set XPSP2=FALSE
set SERVER=FALSE
set NT_SERVER_CHK=TRUE
:START
echo.
echo ======================================================================
echo "svc2kXp.cmd" v2.2_build6a (12.08.2005),
echo 作者: GNU GPL 汉化:Robust
echo ======================================================================
echo.
echo.
set find=%SystemRoot%\System32\find.exe
set regedit=%SystemRoot%\regedit.exe
if not exist "%find%" goto :NOFIND
if not exist "%regedit%" goto :NOREGEDIT
if not "%1" == "%*" goto :SYNTAX
if /I "%1"=="/?" goto :HELP
if /I "%1"=="/help" goto :HELP
if /I "%1"=="-h" goto :HELP
if /I "%1"=="--help" goto :HELP
if /I "%1"=="-?" goto :HELP
if /I "%1"=="--?" goto :HELP
if /I "%1"=="/fix" goto :FIX
if /I "%1"=="/default" goto :RESTORE_DEFAULTS
goto :VERSION
:SYNTAX
echo.
echo.
echo !!程序语法错误!!
echo ________________
echo 参数过少或无参数显示!
rem 原文为德语且是计算机专业词汇,我不太懂 大致翻译的。
rem 德语原文为:Es kann nur ein oder kein Parameter angegeben werden.
echo.
goto :QUIT
:HELP
echo.
echo -= 帮助 =-
echo 参数:
echo /lan.......局域网模式:为企业局域网设置参数.
echo /std.......标准模式:执行所有优化功能,仅保留部分服务不变.
echo /all.......完全模式:按Www.kssysteme.de上所述改变所有设置.
echo /restore...恢复模式:取消最后更改.
echo /reLAN.....局域网恢复模式:恢复局域网相关服务.
echo.
echo 举例: svc2kxp.cmd /all
echo.
set /P CHS= [Press "G" for GNU GPL informations or "Q" for quit]?
if /I "%CHS%"=="G" goto :GNU_GPL
if /I "%CHS%"=="Q" goto :QUIT_EXT
CLS
goto :HELP
:GNU_GPL
CLS
echo GNU-General Public License svc2kxp.cmd相关信息
echo ===============================================================
echo.
echo Copyright (C) 2003-05 Ansgar Wiechers, Torsten Mann
echo 电子邮件: admin@ntsvcfg.de
echo 汉化:Robust QQ:9704177
echo.
echo This program is free software; you can redistribute it and/or modify it under
echo the terms of the GNU General Public License as published by the Free Software
echo Foundation; either version 2 of the License, or (at your option) any later
echo version. This program is distributed in the hope that it will be useful, but
echo WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
echo FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
echo details.
echo.
echo You should have received a copy of the GNU General Public License along with
echo this program; if not, write to the:
echo.
echo Free Software Foundation, Inc.
echo 59 Temple Place, Suite 330
echo Boston, MA 02111-1307, USA.
echo.
set /P CHS= [ "H" :帮助 ; "Q" :退出]?
CLS
if /I "%CHS%"=="H" goto :HELP
if /I "%CHS%"=="Q" goto :QUIT_EXT
goto GNU_GPL
:VERSION
echo 正在检测操作系统版本 ...
if /I "%NT_SERVER_CHK%"=="FALSE" goto :SKIP_NT_SERVER_CHK
REM Checking for running server version
"%regedit%" /e "%TEMP%\~svr.txt" "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ProductOptions"
type "%TEMP%\~svr.txt"|"%find%" /i "Server" >NUL
if not errorlevel 1 set SERVER=TRUE
type "%TEMP%\~svr.txt"|"%find%" /i "LanMan" >NUL
if not errorlevel 1 set SERVER=TRUE
if exist "%TEMP%\~svr.txt" del /F /Q "%TEMP%\~svr.txt"
if /I "%SERVER%"=="TRUE" goto :NTSERVER
:SKIP_NT_SERVER_CHK
ver | "%find%" /i "Windows 2000" > nul
if not errorlevel 1 goto :OS2K
ver | "%find%" /i "Windows XP" > nul
if not errorlevel 1 goto :OSXP
ver | "%find%" /i "Microsoft Windows [Version 5.2.3790]" > nul
if not errorlevel 1 goto :OSXP64
echo !!程序执行失败!!
echo __________
echo.
echo 本程序只能执行在 Windows 2000/XP 环境下!
echo.
goto :QUIT
:NOFIND
echo.
echo !!程序执行失败!!
echo __________
echo.
echo 请检查以下文件是否存在:
echo.
echo.
echo # %SystemRoot%\System32\FIND.EXE
echo.
echo.
goto :QUIT
:NOREGEDIT
echo.
echo !!程序执行失败!!
echo __________
echo.
echo 请检查以下文件是否存在:
echo.
echo.
echo # %SystemRoot%\REGEDIT.EXE
echo.
echo.
goto :QUIT
:NTSERVER
echo.
echo !!程序执行失败!!
echo __________
echo.
echo 本程序不支持 NT server 版本!
echo.
goto :QUIT
:OS2K
rem Specific OS Detection I
set SYSTEM=2k
rem Testing for XP ServicePacks
"%regedit%" /e "%TEMP%\~svclist.txt" "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion"
type "%TEMP%\~svclist.txt"|"%find%" /i "Service Pack 4" >NUL
if errorlevel==1 (
type "%TEMP%\~svclist.txt"|"%find%" /i "Service Pack 3" >NUL
if errorlevel==1 (
type "%TEMP%\~svclist.txt"|"%find%" /i "Service Pack 2" >NUL
if errorlevel==1 (
type "%TEMP%\~svclist.txt"|"%find%" /i "Service Pack 1" >NUL
if errorlevel==1 (
echo !操作系统为Windows 2000 [未知版本 Service Pack]!
goto NO_2KSP
)
echo !操作系统为 Windows 2000 [Service Pack 1]!
goto :NO_2KSP
)
echo !操作系统为 Windows 2000 [Service Pack 2]!
goto :NO_2KSP
)
echo !操作系统为 Windows 2000 [Service Pack 3]!
goto :NO_2KSP
)
echo !操作系统为 Windows 2000 [Service Pack 4]!
goto :NO_2KSP
:NO_2kSP
if exist "%TEMP%\~svclist.txt" del /F /Q "%TEMP%\~svclist.txt"
goto :CONTINUE
:OSXP
rem Specific OS detection II
set SYSTEM=xp
rem Testing for XP ServicePack 2
"%regedit%" /e "%TEMP%\~svclist.txt" "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion"
type "%TEMP%\~svclist.txt"|"%find%" /i "Service Pack 2" >NUL
if errorlevel==1 (
type "%TEMP%\~svclist.txt"|"%find%" /i "Service Pack 1" >NUL
if errorlevel==1 (
SET XPSP2=FALSE
echo !操作系统为 Windows XP [no or unknown Service Pack]!
goto NO_XPSP
)
SET XPSP2=FALSE
echo !操作系统为 Windows XP [Service Pack 1]!
goto :NO_XPSP
)
SET XPSP2=TRUE
echo !操作系统为 Windows XP [ServicePack 2]!
goto :NO_XPSP
:OSXP64
rem Specific OS detection II
set SYSTEM=xp
rem Testing for XP ServicePack 2
"%regedit%" /e "%TEMP%\~svclist.txt" "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion"
type "%TEMP%\~svclist.txt"|"%find%" /i "Service Pack 2" >NUL
if errorlevel==1 (
type "%TEMP%\~svclist.txt"|"%find%" /i "Service Pack 1" >NUL
if errorlevel==1 (
SET XPSP2=FALSE
echo !EXPERIMENTAL! Windows XP64 [no or unknown Service Pack] detected!
goto NO_XPSP
)
SET XPSP2=FALSE
echo !操作系统为 Windows XP64 [Service Pack 1]!
goto :NO_XPSP
)
SET XPSP2=TRUE
echo !操作系统为 Windows XP64 [ServicePack 2]!
goto :NO_XPSP
:NO_XPSP
if exist "%TEMP%\~svclist.txt" del /F /Q "%TEMP%\~svclist.txt"
goto :CONTINUE
:CONTINUE
REM Creating subdirectory "ntsvcfg" in userprofile if necessary
if not exist "%USERPROFILE%\ntsvcfg\*.*" mkdir "%USERPROFILE%\ntsvcfg"
REM Moving old script backup files to ...\%USERNAME%\ntsvcfg :
if exist "%USERPROFILE%\dcom.reg" move /Y "%USERPROFILE%\dcom.reg" "%USERPROFILE%\ntsvcfg\dcom.reg"
if exist "%USERPROFILE%\dcomp.reg" move /Y "%USERPROFILE%\dcomp.reg" "%USERPROFILE%\ntsvcfg\dcomp.reg"
if exist "%USERPROFILE%\services.reg" move /Y "%USERPROFILE%\services.reg" "%USERPROFILE%\ntsvcfg\services.reg"
if exist "%USERPROFILE%\current_services_config.reg" move /Y "%USERPROFILE%\current_services_config.reg" "%USERPROFILE%\ntsvcfg\current_services_config.reg"
if exist "%USERPROFILE%\smb.reg" move /Y "%USERPROFILE%\smb.reg" "%USERPROFILE%\ntsvcfg\smb.reg"
if exist "%USERPROFILE%\FPRINT.REF" move /Y "%USERPROFILE%\FPRINT.REF" "%USERPROFILE%\ntsvcfg\FPRINT.REF"
if exist "%USERPROFILE%\handler_aim.reg" move /Y "%USERPROFILE%\handler_aim.reg" "%USERPROFILE%\ntsvcfg\handler_aim.reg"
if exist "%USERPROFILE%\handler_gopher.reg" move /Y "%USERPROFILE%\handler_gopher.reg" "%USERPROFILE%\ntsvcfg\handler_gopher.reg"
if exist "%USERPROFILE%\handler_telnet.reg" move /Y "%USERPROFILE%\handler_telnet.reg" "%USERPROFILE%\ntsvcfg\handler_telnet.reg"
if exist "%USERPROFILE%\services.reg.default" move /Y "%USERPROFILE%\services.reg.default" "%USERPROFILE%\ntsvcfg\services.reg.default"
if exist "%USERPROFILE%\dcom.reg.default" move /Y "%USERPROFILE%\dcom.reg.default" "%USERPROFILE%\ntsvcfg\dcom.reg.default"
if exist "%USERPROFILE%\dcomp.reg.default" move /Y "%USERPROFILE%\dcomp.reg.default" "%USERPROFILE%\ntsvcfg\dcomp.reg.default"
if exist "%USERPROFILE%\smb.reg.default" move /Y "%USERPROFILE%\smb.reg.default" "%USERPROFILE%\ntsvcfg\smb.reg.default"
if exist "%USERPROFILE%\handler_aim.reg.default" move /Y "%USERPROFILE%\handler_aim.reg.default" "%USERPROFILE%\ntsvcfg\handler_aim.reg.default"
if exist "%USERPROFILE%\handler_gopher.reg.default" move /Y "%USERPROFILE%\handler_gopher.reg.default" "%USERPROFILE%\ntsvcfg\handler_gopher.reg.default"
if exist "%USERPROFILE%\handler_telnet.reg.default" move /Y "%USERPROFILE%\handler_telnet.reg.default" "%USERPROFILE%\ntsvcfg\handler_telnet.reg.default"
REM *****Declarations*****
set SELECT="no"
set SVC_BAK=%USERPROFILE%\ntsvcfg\services.reg
set SVC_SAV=%USERPROFILE%\ntsvcfg\current_services_config.reg
set DCOM_BAK=%USERPROFILE%\ntsvcfg\dcom.reg
set DCOMP_BAK=%USERPROFILE%\ntsvcfg\dcomp.reg
set SMB_BAK=%USERPROFILE%\ntsvcfg\smb.reg
set DCOM_TMP=%TEMP%\dcomoff.reg
set DCOMP_TMP=%TEMP%\dcompoff.reg
set SMB_TMP=%TEMP%\smboff.reg
set FPRINT=%USERPROFILE%\ntsvcfg\FPRINT.REF
set HANDLER1=%USERPROFILE%\ntsvcfg\handler_aim.reg
set HANDLER2=%USERPROFILE%\ntsvcfg\handler_gopher.reg
set HANDLER3=%USERPROFILE%\ntsvcfg\handler_telnet.reg
set NB_TMP=%TEMP%\nb_off.vbs
set srctmp=%USERPROFILE%\~srcreate.vbs
REM *****Options*****
set SCHEDULER_ENABLED=NO
set UseXPSysRestore=YES
set RESTORE=NO
set SVC_MOD=NO
set USE_FPRINT=YES
set Deactivate_NetBIOS=YES
set RESTORE_MODE=2
REM *****APP_PATHs******
set NET=%SystemRoot%\system32\net.exe
set SC=%SystemRoot%\system32\sc.exe
set FC=%SystemRoot%\system32\fc.exe
set IPCONFIG=%SystemRoot%\system32\ipconfig.exe
echo 正在检查用户权限: [local], 请稍候 ...
"%net%" user "%USERNAME%" 2> nul | "%find%" /i "admin" | "%find%" /i /v "name" > nul
if errorlevel 1 (
echo " " " : [domain], 请稍候 ...
"%net%" user "%USERNAME%" /domain 2> nul | "%find%" /i "admin" | "%find%" /i /v "name" > nul
if errorlevel 1 (
echo.
echo 用户权限检查失败!
echo __________
echo.
echo 对不起,您没有相应权限执行本程序,请以系统管理员身份登录.
echo.
goto :END
)
)
set IMPORT_OLD_FILES=FALSE
rem searching for sc.exe
if not exist "%FPRINT%" echo Checking for presence of SC.EXE ...
"%sc%" qc > nul 2>&1
if errorlevel 1 (
echo !!操作失败!!
echo __________
echo.
echo [%SystemRoot%\SYSTEM32\SC.EXE]不存在,请从以下地址下载后在执行本程序.
echo 下载地址:
echo.
echo.
echo -= ftp://ftp.microsoft.com/reskit/win2000/sc.zip =-
echo.
echo 自动安装 SC.EXE
echo ======================
echo 如果已经连接了网络,本程序将尝试自动下载并安装 SC.EXE !
goto :SC_DOWNLOAD
)
if /I "%1"=="/all" (
set SELECT="/all"
goto :SKIP_MENUE
)
if /I "%1"=="/relan" (
set SELECT="/relan"
goto :SKIP_MENUE
)
if /I "%1"=="/std" (
set SELECT="/std"
goto :SKIP_MENUE
)
rem checking for modified services
if /I %CHK_SVC%==YES (
if /I %USE_FPRINT%==YES (
if exist "%FPRINT%" (
rem Creating fingerprint of current service settings...
if exist "%USERPROFILE%\svc2cmp.sav" del /F /Q "%USERPROFILE%\svc2cmp.sav"
"%sc%" query type= service state= all bufsize= 8192 | %FIND% "SERVICE_NAME" >%TEMP%\~svclist.txt
for /F "tokens=1*" %%a in (%TEMP%\~svclist.txt) do (
echo %%b >>"%USERPROFILE%\svc2cmp.sav"
"%sc%" query "%%b" | %FIND% "STATE" >>"%USERPROFILE%\svc2cmp.sav"
"%sc%" qc "%%b" | %FIND% "DISPLAY_NAME" >>"%USERPROFILE%\svc2cmp.sav"
"%SC%" qc "%%b" | %FIND% "START_TYPE" >>"%USERPROFILE%\svc2cmp.sav"
echo. >> "%USERPROFILE%\svc2cmp.sav"
)
del "%TEMP%\~svclist.txt"
"%FC%" "%FPRINT%" "%USERPROFILE%\svc2cmp.sav" >NUL
if errorlevel 1 goto :DIFF
goto OK
:DIFF
echo 正在检查已更改的服务 ... 失败-服务已经被修改! [E]valuate
set SVC_MOD=YES
goto :MOD_END
:OK
echo 正在检查已更改的服务 ... OK
set SVC_MOD=NO
if exist "%USERPROFILE%\svc2cmp.sav" del /F /Q "%USERPROFILE%\svc2cmp.sav"
goto :MOD_END
:MOD_END
REM
)
)
)
set CHK_SVC=NO
if /I "%1"=="/restore" goto :RESTORE
:MENUE
if /I "%1"=="/lan" goto :SKIP_MENUE
echo.
echo -= Auswahl / 概况 =-
echo.
echo.
echo 请选择您需要执行的操作:
echo.
echo (1) LAN: 局域网模式:为使用企业局域网的需要设置参数.
echo (2) Standard: 执行所有优化功能,仅保留部分服务不变.
echo (3) ALL: 按Www.kssysteme.de上所述改变所有设置.
echo (4) restore: 取消最后更改.
echo.
set /P CHS= 请选择: [1],[2],[3],[4], 按[M]查看更多信息,按[Q]退出?
if /I "%CHS%"=="1" (
set SELECT="/lan"
set RESTORE_MODE="1"
goto :SKIP_MENUE
)
if /I "%CHS%"=="2" (
set SELECT="/std"
goto :SKIP_MENUE
)
if /I "%CHS%"=="3" (
set SELECT="/all"
set RESTORE_MODE="3"
goto :SKIP_MENUE
)
if /I "%CHS%"=="4" goto :RESTORE
if /I "%CHS%"=="R" goto :RESTORE
if /I "%CHS%"=="M" goto :MORE_OPTIONS
if /I "%SVC_MOD%"=="YES" if /I "%CHS%"=="E" goto :EVALUATE_SERVICES
if /I "%CHS%"=="G" goto :CREATING_NEW_FINGERPRINT
if /I "%CHS%"=="Q" goto :QUIT
cls
goto :START
:SKIP_MENUE
rem Checking if old restorefiles exists.
rem if it is so old files will be restored before new changes
if not exist "%SVC_BAK%" goto :NO_RESTORE
if /I %RESTORE_MODE%==3 goto :NO_RESTORE
if /I %RESTORE_MODE%==4 goto :NO_RESTORE
set RESTORE=YES
echo.
echo _______________________________________________________________________
echo.
echo [您所选的操作模式为%RESTORE_MODE%]
echo.
echo 注意: 程序在本机发现备份文件!
echo.
echo 这说明本机已经运行过本程序,为了能正确恢复,请您务必保证备份文件的完整性.
pause
echo.
echo.
echo # 开始恢复 ...
goto RESTORE_EXT
:NO_RESTORE
rem query if taskplaner should run
if /I "%SYSTEM%"=="2k" goto :SKIP_SQUERY
if /I "%SYSTEM%"=="xp" (
if /I %SELECT%=="" goto :SKIP_SQUERY
if /I %SELECT%=="/all" goto :SKIP_SQUERY
if /I %XPSP2%==True (
set SCHEDULER_ENABLED=YES
goto :SKIP_SQUERY
)
)
echo.
echo.
echo Rueckfrage / Query
echo ==================
echo.
echo 是否关闭scheduler service服务(计划任务服务)?
echo.
echo 如果您有计划任务 [例如使用了at命令] 或者您不需要系统自动设置还原点
echo ,请按任意键即时关闭135[RPC服务]端口和1025[scheduler服务]端口,否则请按"N"
echo ___________________________________________
echo.
set /P UNDO= 时间计划任务已经取消 - 现在关闭scheduler服务 [y/n]?
if /I "%UNDO%"=="n" set SCHEDULER_ENABLED=YES
:SKIP_SQUERY
if not exist "%SVC_BAK%.default" (
echo.
echo 正在创建备份 ...
"%regedit%" /e "%SVC_BAK%.default" HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services
"%regedit%" /e "%DCOM_BAK%.default" HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Ole
"%regedit%" /e "%DCOMP_BAK%.default" HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Rpc
"%regedit%" /e "%SMB_BAK%.default" HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NetBT\Parameters
"%regedit%" /e "%HANDLER1%.default" HKEY_CLASSES_ROOT\AIM
"%regedit%" /e "%HANDLER2%.default" HKEY_CLASSES_ROOT\gopher
"%regedit%" /e "%HANDLER3%.default" HKEY_CLASSES_ROOT\telnet
echo ... 完成.
)
if exist "%SVC_BAK%" (
if /I %RESTORE_MODE%==2 goto :SKIP_SAVING
if /I %RESTORE_MODE%==4 goto :SKIP_SAVING
)
rem saving registry settings
echo _________________________________________________________________________
echo.
echo [您所选择的操作模式: %RESTORE_MODE%]
echo.
echo 正在保存系统服务设置到
echo %SVC_BAK% ...
"%regedit%" /e "%SVC_BAK%" HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services
echo 正在保存DCOM设置到
echo %DCOM_BAK% ...
"%regedit%" /e "%DCOM_BAK%" HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Ole
echo 正在保存DCOM standard protocols设置到
echo %DCOMP_BAK% ...
"%regedit%" /e "%DCOMP_BAK%" HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Rpc
echo 正在保存SMB设置到
echo %SMB_BAK%
"%regedit%" /e "%SMB_BAK%" HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NetBT\Parameters
echo 正在保存URL-Handler [AIM, GOPHER, TELNET]到
echo %HANDLER1%
"%regedit%" /e "%HANDLER1%" HKEY_CLASSES_ROOT\AIM
echo %HANDLER2%
"%regedit%" /e "%HANDLER2%" HKEY_CLASSES_ROOT\gopher
echo %HANDLER3%
"%regedit%" /e "%HANDLER3%" HKEY_CLASSES_ROOT\telnet
echo.
echo 操作全部完成.
echo ___________________________________________
echo.
:SKIP_SAVING
if /I "%SYSTEM%"=="xp" (
if /I %UseXPSysRestore%==YES (
goto :XPSYSRESTORE
)
)
:XPSYSRESTORE_DONE
rem reconfigure services
rem startup: demand
echo.
echo 设置服务为 手动"demand" ...
echo.
echo 正在检测DHCP ...
"%ipconfig%" -all | "%find%" /i "Lease" > nul
if errorlevel 1 (
rem trying other method for DHCP
"%ipconfig%" -all | "%find%" /i "DHCP-Server" > nul
if errorlevel 1 (
echo ... 未发现活动的DHCP.
echo.
"%sc%" config DHCP start= demand
goto :SKIP_DHCP
)
)
echo ... 发现活动的DHCP, 服务状态将不会被改变!
echo.
:SKIP_DHCP
"%sc%" config dmadmin start= demand
"%sc%" config DNSCache start= demand
"%sc%" config mnmsrvc start= demand
"%sc%" config MSIServer start= demand
"%sc%" config NetDDE start= demand
"%sc%" config NetDDEdsdm start= demand
"%sc%" config Netman start= demand
"%sc%" config NTLMSsp start= demand
"%sc%" config NtmsSvc start= demand
"%sc%" config PolicyAgent start= demand
"%sc%" config RASAuto start= demand
"%sc%" config RASMan start= demand
"%sc%" config RSVP start= demand
"%sc%" config Scardsvr start= demand
"%sc%" query ScardDrv | "%find%" /i "OpenService FAILED" >NUL
if errorlevel 1 "%sc%" config ScardDrv start= demand
if /I %XPSP2%==True (
rem If XP SP2 is installed there are less changes to XP-ICF
if /I %SELECT%=="/std" goto :SKIP_FIREWALL
)
"%sc%" config SharedAccess start= demand
:SKIP_FIREWALL
"%sc%" config Sysmonlog start= demand
"%sc%" config TAPISrv start= demand
"%sc%" config TrkWks start= demand
"%sc%" config UPS start= demand
"%sc%" config W32Time start= demand
"%sc%" config WMI start= demand
if /I %SELECT%=="/all" (
"%sc%" config SamSs start= demand
"%sc%" config LmHosts start= demand
"%sc%" config Winmgmt start= demand
)
if /I "%SYSTEM%"=="2k" (
"%sc%" config AppMgmt start= demand
"%sc%" config Browser start= demand
"%sc%" config clipsrv start= demand
"%sc%" config EventSystem start= demand
"%sc%" config Fax start= demand
"%sc%" config netlogon start= demand
"%sc%" config RPCLocator start= demand
"%sc%" config Utilman start= demand
if /I %SELECT%=="/all" (
"%sc%" config seclogon start= demand
"%sc%" config RPCSs start= demand
"%sc%" config lanmanServer start= demand
)
)
if /I "%SYSTEM%"=="xp" (
"%sc%" config ALG start= demand
"%sc%" config FastUserSwitchingCompatibility start= demand
"%sc%" config helpsvc start= demand
"%sc%" config ImapiService start= demand
"%sc%" config Nla start= demand
"%sc%" config RdSessMgr start= demand
"%sc%" config seclogon start= demand
"%sc%" config stisvc start= demand
"%sc%" config SwPrv start= demand
"%sc%" config TermService start= demand
"%sc%" config upnphost start= demand
"%sc%" config VSS start= demand
"%sc%" query WmdmPmSp | "%find%" /i "OpenService FAILED" >NUL
if errorlevel 1 "%sc%" config WmdmPmSp start= demand
"%sc%" config WmiApSrv start= demand
rem Wireless Zero Configuration - fuer WLAN-Verbindungen notwendig.
rem Falls erforderlich auf AUTO stellen.
rem "%sc%" config WZCSVC start= demand
)
echo.
rem startup: auto
echo 设置服务类型为 自动 "auto" ...
"%sc%" config dmserver start= auto
"%sc%" config eventlog start= auto
"%sc%" config PlugPlay start= auto
"%sc%" config ProtectedStorage start= auto
"%sc%" config sens start= auto
"%sc%" config spooler start= auto
if /I "%SYSTEM%"=="2k" (
"%sc%" config lanmanworkstation start= auto
"%sc%" config alerter start= auto
)
if /I "%SYSTEM%"=="xp" (
"%sc%" query InteractiveLogon | "%find%" /i "OpenService FAILED" >NUL
if errorlevel 1 "%sc%" config InteractiveLogon start= auto
"%sc%" config Audiosrv start= auto
"%sc%" config CryptSvc start= auto
"%sc%" config RPCSs start= auto
"%sc%" config ShellHWDetection start= auto
"%sc%" config srservice start= auto
"%sc%" query uploadmgr | "%find%" /i "OpenService FAILED" >NUL
if errorlevel 1 "%sc%" config uploadmgr start= auto
"%sc%" config WebClient start= auto
)
echo.
rem startup: disabled
echo 设置服务为 禁用 "disabled" ...
"%sc%" config cisvc start= disabled
"%sc%" config MSDTC start= disabled
"%sc%" config RemoteAccess start= disabled
"%sc%" config TlntSvr start= disabled
"%sc%" config messenger start= disabled
if /I %SELECT%=="/all" (
"%sc%" query BITS | "%find%" /i "SERVICE_NAME" >NUL
if not errorlevel 1 "%sc%" config BITS start= disabled
"%sc%" query wuauserv | "%find%" /i "SERVICE_NAME" >NUL
if not errorlevel 1 "%sc%" config wuauserv start= disabled
"%sc%" config schedule start= disabled
"%sc%" config RemoteRegistry start= disabled
)
if /I "%SYSTEM%"=="xp" (
"%sc%" config ERSvc start= disabled
"%sc%" config HidServ start= disabled
"%sc%" config SSDPSRV start= disabled
if /I %SELECT%=="/lan" (
if /I %SCHEDULER_ENABLED%==NO "%sc%" config schedule start= disabled
)
if /I %SELECT%=="/std" (
if /I %SCHEDULER_ENABLED%==NO "%sc%" config schedule start= disabled
)
if /I %XPSP2%==True (
echo.
echo 操作系统为 XPSP2: 正在关闭安全中心 ...
"%sc%" config wscsvc start= disabled
)
)
echo.
echo ------------------
echo 正在检查不需要的系统服务,请稍候 ...
echo.
echo 正在关闭不需要的系统服务,请稍候 ...
echo.
"%sc%" query cisvc | "%find%" /i "4 RUNNING" >NUL
if not errorlevel 1 "%net%" stop cisvc
"%sc%" query RemoteAccess | "%find%" /i "4 RUNNING" >NUL
if not errorlevel 1 "%net%" stop RemoteAccess
"%sc%" query TlntSvr | "%find%" /i "4 RUNNING" >NUL
if not errorlevel 1 "%net%" stop TlntSvr
"%sc%" query MSDTC | "%find%" /i "4 RUNNING" >NUL
if not errorlevel 1 "%net%" stop MSDTC
"%sc%" query messenger | "%find%" /i "4 RUNNING" >NUL
if not errorlevel 1 "%net%" stop messenger
if /I %SELECT%=="/all" (
"%sc%" query BITS | "%find%" /i "SERVICE_NAME" >NUL
if not errorlevel 1 (
"%sc%" query BITS | "%find%" /i "4 RUNNING" >NUL
if not errorlevel 1 "%net%" stop BITS
)
"%sc%" query wuauserv | "%find%" /i "SERVICE_NAME" >NUL
if not errorlevel 1 (
"%sc%" query wuauserv | "%find%" /i "4 RUNNING" >NUL
if not errorlevel 1 "%net%" stop wuauserv
)
"%sc%" query schedule | "%find%" /i "4 RUNNING" >NUL
if not errorlevel 1 "%net%" stop schedule
)
if /I "%SYSTEM%"=="xp" (
if /I %SELECT%=="/lan" (
if /I %SCHEDULER_ENABLED%==NO "%net%" (
"%sc%" query schedule | "%find%" /i "4 RUNNING" >NUL
if not errorlevel 1 "%net%" stop schedule
)
)
if /I %SELECT%=="/std" (
if /I %SCHEDULER_ENABLED%==NO "%net%" (
"%sc%" query schedule | "%find%" /i "4 RUNNING" >NUL
if not errorlevel 1 "%net%" stop schedule
)
if /I %XPSP2%==True (
"%sc%" query wscsvc | "%find%" /i "4 RUNNING" >NUL
if not errorlevel 1 "%net%" stop wscsvc
)
)
echo ------------------
echo 正在关闭 DCOM ...
echo REGEDIT4 > "%DCOM_TMP%"
echo. >> "%DCOM_TMP%"
echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Ole] >> "%DCOM_TMP%"
echo "EnableDCOM"="N" >> "%DCOM_TMP%"
echo "EnableDCOMHTTP"="N" >> "%DCOM_TMP%"
echo. >> "%DCOM_TMP%"
echo. >> "%DCOM_TMP%"
"%regedit%" /s "%DCOM_TMP%"
del /F /Q "%DCOM_TMP%"
echo 正在关闭 DCOM standard protocols ...
echo REGEDIT4 > "%DCOMP_TMP%"
echo. >> "%DCOMP_TMP%"
echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Rpc] >> "%DCOMP_TMP%"
echo "DCOM Protocols"=hex(7):00,00,00,00 >> "%DCOMP_TMP%"
echo. >> "%DCOMP_TMP%"
echo. >> "%DCOMP_TMP%"
"%regedit%" /s "%DCOMP_TMP%"
del /F /Q "%DCOMP_TMP%"
echo 正在关闭 135端口 ...
echo 正在关闭 1025端口...
echo - 正在卸载 RPC Client Protocols
echo REGEDIT4 > "%SMB_TMP%"
echo [-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Rpc\ClientProtocols] >> "%SMB_TMP%"
echo. >> "%SMB_TMP%"
if /I %SCHEDULER_ENABLED%==NO (
echo - Advanced RPC Configuration
echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Rpc\Internet] >> "%SMB_TMP%"
echo "PortsInternetAvailable"="N" >> "%SMB_TMP%"
echo "UseInternetPorts"="N" >> "%SMB_TMP%"
echo. >> "%SMB_TMP%"
)
if /I %XPSP2%==TRUE (
echo - Advanced RPC Configuration
echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Rpc\Internet] >> "%SMB_TMP%"
echo "PortsInternetAvailable"="N" >> "%SMB_TMP%"
echo "UseInternetPorts"="N" >> "%SMB_TMP%"
echo. >> "%SMB_TMP%"
)
echo - 正在删除 URL Handler [AIM,gopher,telnet]
echo [-HKEY_CLASSES_ROOT\AIM] >> "%SMB_TMP%"
echo [-HKEY_CLASSES_ROOT\gopher] >> "%SMB_TMP%"
echo [-HKEY_CLASSES_ROOT\telnet] >> "%SMB_TMP%"
echo. >> "%SMB_TMP%"
echo. >> "%SMB_TMP%"
"%regedit%" /s "%SMB_TMP%"
del /F /Q "%SMB_TMP%"
if /I %SELECT%=="/all" (
echo.
echo 正在关闭 445 端口[SMB] ...
echo REGEDIT4 > "%SMB_TMP%"
echo. >> "%SMB_TMP%"
echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NetBT\Parameters] >> "%SMB_TMP%"
echo "SMBDeviceEnabled"=dword:00000000 >> "%SMB_TMP%"
echo. >> "%SMB_TMP%"
echo. >> "%SMB_TMP%"
"%regedit%" /s "%SMB_TMP%"
del /F /Q "%SMB_TMP%"
set REBOOT_REQUIRED=yes
)
if /I %SELECT%=="/std" (
echo.
echo 正在关闭 445 端口[SMB] ...
echo REGEDIT4 > "%SMB_TMP%"
echo. >> "%SMB_TMP%"
echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NetBT\Parameters] >> "%SMB_TMP%"
echo "SMBDeviceEnabled"=dword:00000000 >> "%SMB_TMP%"
echo. >> "%SMB_TMP%"
echo. >> "%SMB_TMP%"
"%regedit%" /s "%SMB_TMP%"
del /F /Q "%SMB_TMP%"
set REBOOT_REQUIRED=yes
)
if /I %SELECT%=="/std" goto :NB_DISABLE
if /I %SELECT%=="/all" goto :NB_DISABLE
goto :SKIP_NB_DISABLE
:NB_DISABLE
if /I %DEACTIVATE_NETBIOS%==NO (
echo.
echo. 因为SP2 NetBIOS 无效,将不执行关闭NetBIOS的相关操作.
echo.
goto :SKIP_NB_DISABLE
)
rem Because of problems with SP2 Netbios:
if /I %XPSP2%==True (
echo.
echo 提醒:
echo -----
echo 如果您安装Windows XP Service Pack 2 出现了问题,请执行以下操作:
echo
echo.
echo set Deactivate_NetBIOS=NO
echo.
)
rem *** Thx2 Johannes Lichtenberger for the following lines using VBScript***
echo 关闭所有本地接口的 NetBios ...
echo.
echo On Error Resume Next>> "%nb_tmp%"
echo.>> "%nb_tmp%"
echo TcpipoverNetbios = 2 '0=NetbiosfromDHCP 1=EnableNetbios 2=DisableNetbios>> "%nb_tmp%"
echo.>> "%nb_tmp%"
echo strComputer = ".">> "%nb_tmp%"
echo Set objWMIService = GetObject("winmgmts:\\" ^& strComputer ^& "\root\cimv2")>> "%nb_tmp%"
echo Set objNICs = objWMIService.ExecQuery _>> "%nb_tmp%"
echo ("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True")>> "%nb_tmp%"
echo For Each objNic In objNICs>> "%nb_tmp%"
echo errTcpipNetbios = objNic.SetTCPIPNetBIOS(TcpipoverNetbios)>> "%nb_tmp%"
echo Next>> "%nb_tmp%"
"%SYSTEMROOT%\SYSTEM32\CSCRIPT.EXE" "%nb_tmp%"
del /F /Q "%nb_tmp%"
set REBOOT_REQUIRED=yes
:SKIP_NB_DISABLE
rem Skip Billboard because /all is used
if /I %SELECT%=="/all" goto :SW_ALL
if /I %SELECT%=="/std" goto :SW_ALL
if /I %SELECT%=="/relan" goto :SW_ALL
echo.
echo 操作全部完成,按任意键显示执行结果.
pause
cls
echo ___________________________________________________________________
echo.
echo *** Zusammenfassung / 执行结果 ***
echo.
echo Es wurden NICHT alle Aenderungen umgesetzt!
echo Um alle Vorschlaege von kssysteme.de umzusetzen, verwenden Sie
echo bitte den Parameter '/all' oder waehlen Sie im Menue den Punkt "3".
echo.
echo 部分操作没有被执行.
echo 请使用参数 '/all' 以执行 www.ntsvcfg.de 上所列出的所有优化功能!
echo ___________________________________________________________________
:SW_ALL
if /I %SELECT%=="/relan" (
rem startup: auto
echo.
echo ------------------
echo Re-enabling services ...
"%sc%" config LmHosts start= auto
"%sc%" config RemoteRegistry start= auto
"%sc%" config SamSs start= auto
"%sc%" config Winmgmt start= auto
if /I "%SYSTEM%"=="2k" (
"%sc%" config RPCSs start= auto
"%sc%" config lanmanServer start= auto
"%sc%" config seclogon start= auto
)
if /I "%SYSTEM%"=="XP" (
rem "%sc%" config SharedAccess start= auto
)
rem start re-enabled services
echo.
echo ------------------
echo [Re]starting services ...
echo 正在重新启动服务.....
echo.
"%sc%" query RemoteRegistry | "%find%" /i "1 STOPPED" >NUL
if not errorlevel 1 "%net%" start RemoteRegistry
"%sc%" query SamSs | "%find%" /i "1 STOPPED" >NUL
if not errorlevel 1 "%net%" start SamSs
"%sc%" query LmHosts | "%find%" /i "1 STOPPED" >NUL
if not errorlevel 1 "%net%" start LmHosts
"%sc%" query Winmgmt | "%find%" /i "1 STOPPED" >NUL
if not errorlevel 1 "%net%" start Winmgmt
if /I "%SYSTEM%"=="2k" (
"%sc%" query LanmanServer | "%find%" /i "1 STOPPED" >NUL
if not errorlevel 1 "%net%" start lanmanServer
"%sc%" query RPCSs | "%find%" /i "1 STOPPED" >NUL
if not errorlevel 1 "%net%" start RPCSs
"%sc%" query Seclogon | "%find%" /i "1 STOPPED" >NUL
if not errorlevel 1 "%net%" start seclogon
)
if /I "%SYSTEM%"=="XP" (
rem "%net%" start SharedAccess
)
rem enable SMB port 445
echo.
echo ------------------
echo 正在启用445端口[SMB] ...
echo REGEDIT4 > "%SMB_TMP%"
echo. >> "%SMB_TMP%"
echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NetBT\Parameters] >> "%SMB_TMP%"
echo "SMBDeviceEnabled"=dword:00000001 >> "%SMB_TMP%"
echo. >> "%SMB_TMP%"
echo. >> "%SMB_TMP%"
"%regedit%" /s "%SMB_TMP%"
del /F /Q "%SMB_TMP%"
set REBOOT_REQUIRED=yes
)
rem Creating fingerprint of current service settings...
if exist "%FPRINT%" del /F /Q "%FPRINT%"
if /I %USE_FPRINT%==YES (
echo.
echo 正在创建记录点,请稍候 ...
"%sc%" query type= service state= all bufsize= 8192 | %FIND% "SERVICE_NAME" > %TEMP%\~svclist.txt
for /F "tokens=1*" %%a in (%TEMP%\~svclist.txt) do (
echo %%b >>"%FPRINT%"
"%sc%" query "%%b" | %FIND% "STATE" >>"%FPRINT%"
"%sc%" qc "%%b" | %FIND% "DISPLAY_NAME" >>"%FPRINT%"
"%SC%" qc "%%b" | %FIND% "START_TYPE" >>"%FPRINT%"
echo. >> "%FPRINT%"
)
del "%TEMP%\~svclist.txt"
echo ... 完成.
)
goto :END
:RESTORE
echo ____________________________________________________
echo.
echo 撤消所有操作 [y/n]?
set /P UNDO= Undo last changes [y/n]?
if /I "%UNDO%"=="y" (
echo _______________________________________________________________
echo.
echo -------
:RESTORE_EXT
if exist "%SVC_BAK%" (
echo 正在启用服务 ...
echo ["%SVC_BAK%"]
"%regedit%" /s "%SVC_BAK%"
set action=""
)
if exist "%DCOM_BAK%" (
echo 正在启用 DCOM ...
echo ["%DCOM_BAK%"]
"%regedit%" /s "%DCOM_BAK%"
)
if exist "%DCOMP_BAK%" (
echo 正在启用 DCOM-standard protocols ...
echo ["%DCOMP_BAK%"]
"%regedit%" /s "%DCOMP_BAK%"
)
if exist "%SMB_BAK%" (
echo 正在启用 SMB-settings ...
echo ["%SMB_BAK%"]
"%regedit%" /s "%SMB_BAK%"
)
if exist "%HANDLER1%" (
echo 正在启用 URL_HANDLER AIM ...
echo ["%HANDLER1%"]
"%regedit%" /s "%HANDLER1%"
)
if exist "%HANDLER2%" (
echo 正在启用 URL_HANDLER GOPHER ...
echo ["%HANDLER2%"]
"%regedit%" /s "%HANDLER2%"
)
if exist "%HANDLER3%" (
echo 正在启用 URL_HANDLER TELNET ...
echo ["%HANDLER3%"]
"%regedit%" /s "%HANDLER3%"
)
rem Skipping back to next state
if /I "%RESTORE%"=="YES" goto :NO_RESTORE
echo 正在移除 RPC Internet key ....
echo REGEDIT4 >"%USERPROFILE%\svc_fix.reg"
echo. >>"%USERPROFILE%\svc_fix.reg"
echo [-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Rpc\Internet] >>"%USERPROFILE%\svc_fix.reg"
echo. >>"%USERPROFILE%\svc_fix.reg"
echo. >>"%USERPROFILE%\svc_fix.reg"
"%regedit%" /s "%USERPROFILE%\svc_fix.reg"
del /F /Q "%USERPROFILE%\svc_fix.reg"
rem Creating fingerprint of current service settings...
if exist "%FPRINT%" del /F /Q "%FPRINT%"
if /I %USE_FPRINT%==YES (
echo.
echo 正在创建记录点,请稍候 ...
"%sc%" query type= service state= all bufsize= 8192 | %FIND% "SERVICE_NAME" > %TEMP%\~svclist.txt
for /F "tokens=1*" %%a in (%TEMP%\~svclist.txt) do (
echo %%b >>"%FPRINT%"
"%sc%" query "%%b" | %FIND% "STATE" >>"%FPRINT%"
"%sc%" qc "%%b" | %FIND% "DISPLAY_NAME" >>"%FPRINT%"
"%SC%" qc "%%b" | %FIND% "START_TYPE" >>"%FPRINT%"
echo. >> "%FPRINT%"
)
del "%TEMP%\~svclist.txt"
echo ... 完成.
)
echo.
echo _______________________________________________________________
echo.
echo *** Zusammenfassung / 执行结果 ***
echo.
echo 恢复操作已经完成.
echo 如果您需要使用NetBios,请在相应的网卡上启用NetBios服务,然后重新启动电脑.
echo ________________________________________________________________
)
goto :END
:RESTORE_DEFAULTS
echo.
echo *** Restore Factory Settings ***
echo.
echo ______________________________________________________________________________
echo.
echo Einstellungen vor Erstanwendung des Scripts wiederherstellen (ausser NetBIOS)?
set /P UNDO= Restore defaults (before using script, except NetBIOS) [y/n]?
if /I "%UNDO%"=="y" (
echo.
echo - 正在恢复原始设置 ...
if exist "%SVC_BAK%.default" %regedit%" /s "%SVC_BAK%.default"
if exist "%DCOM_BAK%.default" "%regedit%" /s "%DCOM_BAK%.default"
if exist "%DCOMP_BAK%.default" "%regedit%" /s "%DCOMP_BAK%.default"
if exist "%SMB_BAK%.default" "%regedit%" /s "%SMB_BAK%.default"
if exist "%HANDLER1%.default" "%regedit%" /s "%HANDLER1%.default"
if exist "%HANDLER2%.default" "%regedit%" /s "%HANDLER2%.default"
if exist "%HANDLER3%.default" "%regedit%" /s "%HANDLER3%.default"
echo ... 完成.
echo - 正在移除 RPC Internet key ...
echo REGEDIT4 >"%USERPROFILE%\svc_fix.reg"
echo. >>"%USERPROFILE%\svc_fix.reg"
echo [-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Rpc\Internet] >>"%USERPROFILE%\svc_fix.reg"
echo. >>"%USERPROFILE%\svc_fix.reg"
echo. >>"%USERPROFILE%\svc_fix.reg"
"%regedit%" /s "%USERPROFILE%\svc_fix.reg"
del /F /Q "%USERPROFILE%\svc_fix.reg"
echo ... 完成.
)
goto :QUIT
:SC_DOWNLOAD
echo ______________________________________________________________
echo.
echo Besteht eine aktive Internetverbindung?
echo 请检查您是否已经正常连接上互联网?
echo.
set /P UNDO= 请选择: [y/n]?
if /I "%UNDO%"=="y" goto :SC_DOWNLOAD_OK
goto :END
:SC_DOWNLOAD_OK
if exist "%SYSTEMROOT%\sc.zip" goto :SCE
echo 正在生成自动下载脚本 ...
if exist "%USERPROFILE%"\script_sc.ls del /F "%USERPROFILE%\script_sc.ls"
echo open 207.46.133.140 >"%USERPROFILE%\script_sc.ls"
echo user anonymous anonymous@aol.com >>"%USERPROFILE%\script_sc.ls"
echo type binary >>"%USERPROFILE%\script_sc.ls"
echo user anonymous anonymous@aol.com >>"%USERPROFILE%\script_sc.ls"
echo type binary >>"%USERPROFILE%\script_sc.ls"
echo get /reskit/win2000/sc.zip "%SYSTEMROOT%\System32\SC.ZIP" >>"%USERPROFILE%\script_sc.ls"
echo quit >>"%USERPROFILE%\script_sc.ls"
echo 正在下载SC.EXE ...
ftp -s:"%USERPROFILE%\script_sc.ls"
del /F "%USERPROFILE%\script_sc.ls"
:SCE
if exist "%SYSTEMROOT%\System32\pkunzip.exe" goto :PKE
echo 正在生成自动下载脚本 ...
if exist "%USERPROFILE%"\script_pk.ls del /F "%USERPROFILE%\script_pk.ls"
echo open ftp.uni-duesseldorf.de >"%USERPROFILE%\script_pk.ls"
echo user anonymous anonymous@aol.com >>"%USERPROFILE%\script_pk.ls"
echo type binary >>"%USERPROFILE%\script_pk.ls"
echo user anonymous anonymous@aol.com >>"%USERPROFILE%\script_pk.ls"
echo type binary >>"%USERPROFILE%\script_pk.ls"
echo get /pub/ie/pkunzip.exe "%SYSTEMROOT%\System32\pkunzip.exe" >>"%USERPROFILE%\script_pk.ls"
echo quit >>"%USERPROFILE%\script_pk.ls"
echo 正在下载 PKUNZIP.EXE ...
ftp -s:"%USERPROFILE%\script_pk.ls"
del /F "%USERPROFILE%\script_pk.ls"
:PKE
if not exist "%SYSTEMROOT%\System32\sc.zip" (
echo.
echo 下载 SC.ZIP 失败. 请手动下载SC.ZIP并复制到
echo %SYSTEMROOT%\.
)
if not exist "%SYSTEMROOT%\System32\pkunzip.exe" (
echo.
echo Die Datei PKUNZIP.EXE konnte nicht gefunden werden. Diese wird zum
echo Entpacken des Archivs SC.ZIP benoetigt!
echo.
echo 没有找到PKUNZIP.EXE . 现在需要用它来解压 SC.EXE.
)
if exist "%SYSTEMROOT%\System32\SC.ZIP" (
if exist "%SYSTEMROOT%\System32\pkunzip.exe" (
"%SYSTEMROOT%\System32\pkunzip.exe" -e "%SYSTEMROOT%\System32\sc.zip" sc.exe
)
)
move /Y sc.exe "%SYSTEMROOT%\System32\"
echo.
echo 正在重新启动脚本...
goto :START
:FIX
echo.
echo -= svc2kxp.cmd taskplaner fix =-
echo.
echo.
echo 请按"Y" 修复 "scheduler doesn't start under Windows XP
echo after running script v2.0 - v2.1build0".
echo.
set /P UNDO= 开始修复 [y/n]?
if /I "%UNDO%"=="y" (
echo REGEDIT4 >"%USERPROFILE%\svc_fix.reg"
echo. >>"%USERPROFILE%\svc_fix.reg"
echo [-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Rpc\Internet] >>"%USERPROFILE%\svc_fix.reg"
echo. >>"%USERPROFILE%\svc_fix.reg"
echo. >>"%USERPROFILE%\svc_fix.reg"
"%regedit%" /s "%USERPROFILE%\svc_fix.reg"
del /F /Q "%USERPROFILE%\svc_fix.reg"
echo ______________________________________
echo.
echo 修复完成.请重新启动计算机并尝试开启端口 ...!
)
rem Creating fingerprint of current service settings...
if exist "%FPRINT%" del /F /Q "%FPRINT%"
goto quit
if /I %USE_FPRINT%==YES (
echo.
echo 正在创建记录点,请稍候 ...
"%sc%" query type= service state= all bufsize= 8192 | %FIND% "SERVICE_NAME" > %TEMP%\~svclist.txt
for /F "tokens=1*" %%a in (%TEMP%\~svclist.txt) do (
echo %%b >>"%FPRINT%"
"%sc%" query "%%b" | %FIND% "STATE" >>"%FPRINT%"
"%sc%" qc "%%b" | %FIND% "DISPLAY_NAME" >>"%FPRINT%"
"%SC%" qc "%%b" | %FIND% "START_TYPE" >>"%FPRINT%"
echo. >> "%FPRINT%"
)
del "%TEMP%\~svclist.txt"
echo ... 完成.
)
goto :QUIT
rem **** Additional Feature List ****
:MORE_OPTIONS
cls
echo ______________________________________________________________________________
echo.
echo *** Weitere Optionen / 详细菜单 ***
echo =====================================
echo.
if /I "%SVC_MOD%"=="YES" (
echo [E]...显示程序改动的服务清单.
echo.
)
echo [G]...创建一个新记录点用做程序检测的起始状态 .
echo.
echo [S]...保存当前设置.
echo.
echo [B]...返回.
echo.
echo [Q]...退出.
echo.
echo ______________________________________________________________________________
echo.
if /I "%SVC_MOD%"=="NO" set /P CHS= 请选择: [G], [S], [B]ack or [Q]uit?
if /I "%SVC_MOD%"=="YES" set /P CHS= 请选择: [E], [G], [S], [B], [Q]?
if /I "%SVC_MOD%"=="YES" if /I "%CHS%"=="E" GOTO :EVALUATE_SERVICES
if /I "%CHS%"=="G" GOTO :CREATING_NEW_FINGERPRINT
if /I "%CHS%"=="B" (
CLS
GOTO :START
)
if /I "%CHS%"=="S" GOTO :SAVE_SVC_SETTINGS
if /I "%CHS%"=="Q" GOTO :QUIT
GOTO :MORE_OPTIONS
:EVALUATE_SERVICES
cls
echo ______________________________________________________________________________
echo.
echo *** Evaluate Services Menue ***
echo.
"%FC%" /N "%FPRINT%" "%USERPROFILE%\svc2cmp.sav"
echo ______________________________________________________________________________
echo.
set /P CHS= 请选择: [B]ack, [U]pdate or [Q]uit?
if /I "%CHS%"=="B" GOTO :MORE_OPTIONS
if /I "%CHS%"=="U" GOTO :CREATING_NEW_FINGERPRINT
if /I "%CHS%"=="Q" GOTO :QUIT
GOTO :MORE_OPTIONS
:SAVE_SVC_SETTINGS
cls
echo ______________________________________________________________________________
echo.
echo *** 保存当前设置 ***
echo --------------------------------------------
echo.
echo Soll die aktuelle Dienstekonfiguration gesichert werden?
echo.
set /P CHS= 是否保存当前设置 (y/n)?
if /I "%CHS%"=="N" GOTO :MORE_OPTIONS
if /I "%CHS%"=="Y" (
echo 正在将当前设置保存到:
echo.
echo - %SVC_SAV%
"%regedit%" /e "%SVC_SAV%" HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services
echo.
echo ... 完成!
echo ______________________________________________________________________________
echo.
echo 请按任意键返回.
pause>NUL
)
if /I "%CHS%"=="Q" GOTO :QUIT
goto :MORE_OPTIONS
pause >NUL
goto :MORE_OPTIONS
:CREATING_NEW_FINGERPRINT
cls
echo ______________________________________________________________________________
echo.
echo *** 创建新记录点 ***
echo ------------------------------
echo.
set /P CHS= 是否创建新记录点 [Y/N]?
if /I "%CHS%"=="Y" (
if exist "%FPRINT%" del /F /Q "%FPRINT%"
echo 正在建新记录点,请稍候 ...
"%sc%" query type= service state= all bufsize= 8192 | %FIND% "SERVICE_NAME" > %TEMP%\~svclist.txt
for /F "tokens=1*" %%a in (%TEMP%\~svclist.txt) do (
echo %%b >>"%FPRINT%"
"%sc%" query "%%b" | %FIND% "STATE" >>"%FPRINT%"
"%sc%" qc "%%b" | %FIND% "DISPLAY_NAME" >>"%FPRINT%"
"%SC%" qc "%%b" | %FIND% "START_TYPE" >>"%FPRINT%"
echo. >> "%FPRINT%"
)
del "%TEMP%\~svclist.txt"
echo ... 完成.
echo ______________________________________________________________________________
echo.
echo [按任意键继续]
set CHK_SVC=YES
PAUSE >NUL
)
cls
GOTO :MORE_OPTIONS
:XPSYSRESTORE
REM Creating A System Restore Point // Source Code: MS Technet Scriptcenter
echo.
echo # 正在创建系统还原点 [if XP SysRestore is enabled] ...
if exist "%srctmp%" del /F /Q "%srctmp%"
echo CONST DEVICE_DRIVER_INSTALL = 10 >"%srctmp%"
echo CONST BEGIN_SYSTEM_CHANGE = 100 >>"%srctmp%"
echo.>>"%srctmp%"
echo strComputer = ".">>"%srctmp%"
echo Set objWMIService = GetObject("winmgmts:" _ >>"%srctmp%"
echo ^& "{impersonationLevel=impersonate}!\\" ^& strComputer ^& "\root\default")>>"%srctmp%"
echo.>>"%srctmp%"
echo Set objItem = objWMIService.Get("SystemRestore")>>"%srctmp%"
echo errResults = objItem.CreateRestorePoint _ >>"%srctmp%"
echo ("svc2kxp.cmd created restore point", DEVICE_DRIVER_INSTALL, BEGIN_SYSTEM_CHANGE)>>"%srctmp%"
"%srctmp%"
del /F /Q "%srctmp%"
echo.
goto :XPSYSRESTORE_DONE
:END
if "%REBOOT_REQUIRED%"=="yes" (
echo.
echo ______________________________________________________
echo.
echo *** Zusammenfassung / 执行结果 ***
echo.
if /I %SELECT%=="/all" echo 所有优化操作成功执行完毕.
if /I %SELECT%=="/std" echo 部分服务没有被改变.
if /I %SELECT%=="/relan" echo 局域网相关服务被重新启动.
echo 请重新启动您的计算机.
echo ______________________________________________________
)
:QUIT
cls
echo ________________________________________________________________
echo.
echo 请登陆www.ntsvcfg.de或者"www.ntsvcfg.de/ntsvcfg_eng"以获得更多资料
echo 汉化:Robust QQ:9704177
echo ________________________________________________________________
echo [按任意键退出]
echo ------------------------------------------------------
echo.
if /I "%1"=="" pause>NUL
endlocal
if exist "%USERPROFILE%\svc2cmp.sav" del /F /Q "%USERPROFILE%\svc2cmp.sav"
echo.
|