| |
| @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 " |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| 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 :eofCOPY |