标题: [系统增强] 批处理修改IDE通道的设备类型为“无” [打印本页]
作者: lxzzr 时间: 2009-10-14 16:03 标题: 批处理修改IDE通道的设备类型为“无”
将IDE通道的设备类型为“自动检测”修改为“无”
其作用:加速系统的启动.
代码:-
- @echo off
- setlocal enabledelayedexpansion
- set "name=%windir%\Backup.dat"
- set "usdt=UserSlaveDeviceType"
- set "sids=SlaveIdDataCheckSum"
- set "umdt=UserMasterDeviceType"
- set "mids=MasterIdDataCheckSum"
- set "wpsc=wmic /namespace:\\root\default path stdregprov call "
- 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
- )
-
- for /f "usebackq skip=3 tokens=2 delims={}" %%a in (
- `"%wpsc%Enumkey ^&H80000002,"%sccc%""`
- ) do (
- set keynames=%%~a
- set keynames=!keynames:", "= !
- )
- 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%
- )
- )
- :_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
复制代码
作者: junren 时间: 2009-10-28 14:40
请问楼主这软件会否把挂有设备的通道设置为“无”,比如光驱,开机后会丢失设备。。。
作者: junren 时间: 2009-10-28 14:41
一般新装机我都手动设置,有了这个就方便多了。
作者: lxzzr 时间: 2009-10-28 15:14 标题: 回复 2楼 的帖子
不会的....
作者: junren 时间: 2009-11-1 12:13 标题: 回复 4楼 的帖子
谢谢楼主分享,支持全自动化解放手工操作,。
作者: slore 时间: 2009-11-1 14:23
速度太慢了。。。
没有手动去点快啊。
作者: lxzzr 时间: 2009-11-1 14:28 标题: 回复 6楼 的帖子
你是第一次运行吧
作者: slore 时间: 2009-11-1 17:53
wmic貌似是第一次。。。不过似乎就是要个GUID?不知道有没有其他快的方法。
还是你设置的name是backup.bat?
为什么感觉里面的值和设置后一样?是3。而且一些键值在注册表里面没看到。。。我只有slave的,没master的……但是backup里面有。
而且建议直接输出成bat,双击可以恢复。
作者: lxzzr 时间: 2009-11-4 14:55 标题: 回复 8楼 的帖子
这样吧,我将我的电脑里一个优化系统设置的脚本发上来
只对系统的服务和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 编辑 ]
欢迎光临 批处理之家 (http://bathome.net./) |
Powered by Discuz! 7.2 |