这样吧,我将我的电脑里一个优化系统设置的脚本发上来
只对系统的服务和IDE通道做了设置,有备份和恢复的...
-
- @echo off
- setlocal enabledelayedexpansion
- set "name=%windir%\Backup.dat"
- set "usdt=UserSlaveDeviceType"
- set "sids=SlaveIdDataCheckSum"
- set "umdt=UserMasterDeviceType"
- set "mids=MasterIdDataCheckSum"
- set "wpws=wmic path Win32_Service"
- set "wpsc=wmic /namespace:\\root\default path stdregprov call "
- rem Alerter Disabled Stopped
- rem ALG Disabled Stopped
- rem ccosm Disabled Stopped
- rem CiSvc Disabled Stopped
- rem ClipSrv Disabled Stopped
- rem Dnscache Disabled Stopped
- rem ERSvc Disabled Stopped
- rem LanmanServer Disabled Stopped
- rem LmHosts Disabled Stopped
- rem Messenger Disabled Stopped
- rem NetDDE Disabled Stopped
- rem NetDDEdsdm Disabled Stopped
- rem Nla Disabled Stopped
- rem NtLmSsp Disabled Stopped
- rem NtmsSvc Disabled Stopped
- rem NVSvc Disabled Stopped
- rem ProtectedStorage Disabled Stopped
- rem RemoteAccess Disabled Stopped
- rem RemoteRegistry Disabled Stopped
- rem Schedule Disabled Stopped
- rem seclogon Disabled Stopped
- rem SharedAccess Disabled Stopped
- rem ShellHWDetection Disabled Stopped
- rem Spooler Disabled Stopped
- rem srservice Disabled Stopped
- rem SSDPSRV Disabled Stopped
- rem TermService Disabled Stopped
- rem TlntSvr Disabled Stopped
- rem TrkWks Disabled Stopped
- rem UMWdf Disabled Stopped
- rem W32Time Disabled Stopped
- rem WebClient Disabled Stopped
- rem WmiApSrv Disabled Stopped
- rem wscsvc Disabled Stopped
- rem wuav Disabled Stopped
- rem WZCSVC Disabled Stopped
- rem ......
- echo.
- echo.-------------------------------------------------------------------------------
- echo.
- echo. Copyright (C) 2002-2008 By:lxzzr E-mail:lxzzr@21cn.com
- echo.
- echo. A the script that can speed system a start.
- echo.
- echo.
- echo.
- echo.
- echo. Test :Windows xp1/xp2/xp3
- echo.
- echo. [B.] Backup and start setup.
- echo. [R.] From the last time backup recovery.
- echo. [Q.] Other key to exit.
- echo.
- echo.-------------------------------------------------------------------------------
- set /p Choices=Please input [B,R,Q]:
- if /i %Choices% == B goto :Backup
- if /i %Choices% == R goto :Recovery
- exit
- :Backup
- echo.Backup ...
- echo.Save the file at: %name%
- echo.
- echo.Need few seconds,Please wait ...
- mshta vbscript:createobject("wscript.shell").run("%windir%\system32\defrag d: -f",0)(window.close)
- for /f "delims=" %%i in ('%wpws% get Name^,StartMode^,State') do echo rem %%i>>%name%
- echo.
- for /f "tokens=2 delims= " %%a in ('more +10^<"%~fs0"') do (
- set /a temp_+=1
- (
- if !temp_! lss 47 (
- %wpws% where name="%%a" call ChangeStartMode Disabled
- %wpws% where name="%%a" call stopservice
- )
- )>nul 2>nul
- )
- (
- for /f "usebackq skip=1 delims= " %%a in (
- `"Wmic Path Win32_PnPEntity where name="主要 IDE 通道" get ClassGuid"`
- ) do (
- set sccc=SYSTEM\CurrentControlSet\Control\Class\%%a
- )
- )>nul 2>nul
- (
- for /f "usebackq skip=3 tokens=2 delims={}" %%a in (
- `"%wpsc%Enumkey ^&H80000002,"%sccc%""`
- ) do (
- set keynames=%%~a
- set keynames=!keynames:", "= !
- )
- )>nul 2>nul
- for %%i in (!keynames!) do (
- set A=
- (
- for /f "usebackq skip=6 tokens=2* delims== " %%a in (
- `"%wpsc%getstringvalue ^&H80000002,"%sccc%\%%i","DriverDesc""`
- ) do (
- set value_=%%a
- set value_=!value_:"=!
- )
- )>nul 2>nul
- if !value_! == 主要 (
- call :sub_a %%i %usdt% %umdt%
- call :sub_b %%i %sids% %usdt%
- call :sub_b %%i %mids% %umdt%
- )
- if !value_! == 次要 (
- call :sub_a %%i %usdt% %umdt%
- call :sub_b %%i %sids% %usdt%
- call :sub_b %%i %mids% %umdt%
- )
- )
- goto :_end
- :Recovery
- if not exist %name% (
- echo.You should first backup,please press any key to exit.
- pause>nul
- exit
- )
- echo.Recovery ...
- echo.From: %name%
- echo.
- echo.Need few seconds,Please wait ...
- echo.
- (
- for /f "skip=1 tokens=2,3,4 delims= " %%a in (%name%) do (
- set startmode=
- if /i not "%%b" == "Auto" (
- set startmode=%%b
- )
- %wpws% where name="%%a" call ChangeStartMode !startmode!
- if /i "%%c" == "Running" (
- %wpws% where name="%%a" call startservice
- ) else (
- %wpws% where name="%%a" call stopservice
- )
- )
- for /f "eol=r tokens=1,2 delims=," %%a in (%name%) do %wpsc%deleteValue ^&H80000002,%%a,%%b
- del %name% /q
- )>nul 2>nul
- :_end
- echo.Done,please press any key to exit.
- pause>nul
- exit
- :sub_a
- echo."%sccc%\%1","%2","3">>%name%
- echo."%sccc%\%1","%3","3">>%name%
- (%wpsc%SetDWORDValue ^&H80000002,"%sccc%\%1","%2","3")>nul 2>nul
- (%wpsc%SetDWORDValue ^&H80000002,"%sccc%\%1","%3","3")>nul 2>nul
- goto :eof
- :sub_b
- (
- for /f "usebackq skip=6 tokens=3 delims= " %%a in (
- `"%wpsc%getdwordvalue ^&H80000002,"%sccc%\%1","%2""`
- ) do (
- set A=%%a
- if defined A %wpsc%deleteValue ^&H80000002,"%sccc%\%1","%3"
- )
- )>nul 2>nul
- goto :eof
复制代码
[ 本帖最后由 lxzzr 于 2009-11-4 15:01 编辑 ] |