逗人, 我一直在努力解决如何禁用Windows以节省USB读卡器的电量,最后使用 RegShot 我设法找到负责这些设置的注册表输入,因此我设法创建了两个 reg查询正在扫描计算机:
REG QUERY HKLM /v SelectiveSuspendFeatureOn /s
REG QUERY HKLM /v EnableSelectiveSuspend /s
示例输出:
C:\ Users \ asd \ Desktop> REG QUERY HKLM / v SelectiveSuspendFeatureOn / s的
HKEY_LOCAL_MACHINE \ SYSTEM \ ControlSet001 \服务\ GemCCID SelectiveSuspendFeatureOn REG_DWORD 0x1
HKEY_LOCAL_MACHINE \ SYSTEM \ ControlSet002 \服务\ GemCCID SelectiveSuspendFeatureOn REG_DWORD 0x1
HKEY_LOCAL_MACHINE \ SYSTEM \ CURRENTCONTROLSET \服务\ GemCCID SelectiveSuspendFeatureOn REG_DWORD 0x1
搜索结束:找到3场比赛。
C:\ Users \ asd \ Desktop> REG QUERY HKLM / v EnableSelectiveSuspend / s
HKEY_LOCAL_MACHINE \ SYSTEM \ ControlSet001 \ Enum \ IUSB3 \ ROOT_HUB30 \ 4& 22fe6fd& 0 \ Device Parameters EnableSelectiveSuspend REG_DWORD 0x1
HKEY_LOCAL_MACHINE \ SYSTEM \ ControlSet002 \ Enum \ IUSB3 \ ROOT_HUB30 \ 4& 22fe6fd& 0 \ Device Parameters EnableSelectiveSuspend REG_DWORD 0x1
HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Enum \ IUSB3 \ ROOT_HUB30 \ 4& 22fe6fd& 0 \ De vice Parameters EnableSelectiveSuspend REG_DWORD 0x1
搜索结束:找到3场比赛。
所以现在我能够扫描那些地方并获取注册表路径后,我想将它们中的每一个设置为0,所以我设法找到并使用它.bat:
@echo off
cls
:startreg
cls
set regq= REG QUERY HKLM /v SelectiveSuspendFeatureOn /s %curuser%
for /f "tokens=* delims=~" %%A IN ('%regq% ^| findstr /i "HKEY_LOCAL_MACHINE"') DO set regkey=%%A
Reg add %regkey% /v SelectiveSuspendFeatureOn /t REG_DWORD /d 0 /f
rem Reg add %regkey% /v EnableSelectiveSuspend /t REG_DWORD /d 0 /f
pause
exit
现在这就是我卡住的地方,我收到了两个与.bat本身有关的请求/问题:
@@ EDIT.1 @@
原来有些注册表项无法通过.bat更改(路径无法读取),因此应生成.reg文件:
正确的.reg文件示例:
Windows注册表编辑器版本5.00
[HKEY_LOCAL_MACHINE \ SYSTEM \ ControlSet001 \服务\ GemCCID] " SelectiveSuspendFeatureOn" = DWORD:00000000
[HKEY_LOCAL_MACHINE \ SYSTEM \ ControlSet004 \服务\ GemCCID] " SelectiveSuspendFeatureOn" = DWORD:00000000
[HKEY_LOCAL_MACHINE \ SYSTEM \ CURRENTCONTROLSET \服务\ GemCCID] " SelectiveSuspendFeatureOn" = DWORD:00000000
[HKEY_LOCAL_MACHINE \ SYSTEM \ ControlSet004 \枚举\ IUSB3 \ ROOT_HUB30 \ 4安培; 32305751&安培; 0 \设备 参数]" EnableSelectiveSuspend" = dword:00000000
[HKEY_LOCAL_MACHINE \ SYSTEM \ ControlSet004 \枚举\ USB \ VID_0424&安培; PID_2512 \ 5安培; 36b4634f&安培; 0和3 \设备 参数]" EnableSelectiveSuspend" = dword:00000000
[HKEY_LOCAL_MACHINE \ SYSTEM \ ControlSet004 \枚举\ USB \ VID_0424&安培; PID_2514 \ 6和; 234568e7&安培0安培; 1台\设备 参数]" EnableSelectiveSuspend" = dword:00000000
[HKEY_LOCAL_MACHINE \ SYSTEM \ CURRENTCONTROLSET \枚举\ IUSB3 \ ROOT_HUB30 \ 4安培; 32305751&安培; 0 \设备 参数]" EnableSelectiveSuspend" = dword:00000000
[HKEY_LOCAL_MACHINE \ SYSTEM \ CURRENTCONTROLSET \枚举\ USB \ VID_0424&安培; PID_2512 \ 5安培; 36b4634f&安培; 0和3 \设备 参数]" EnableSelectiveSuspend" = dword:00000000
[HKEY_LOCAL_MACHINE \ SYSTEM \ CURRENTCONTROLSET \枚举\ USB \ VID_0424&安培; PID_2514 \ 6和; 234568e7&安培0安培; 1台\设备 参数]" EnableSelectiveSuspend" = dword:00000000
期待您的回答。
Patryk
@@ EDIT 2 @@
我设法创建了我需要的逻辑:
@echo off
cls
:startreg
cls
echo Scanning computer in order to apply Power Managment adjustments for USB readers
set NLM=^
set NL=^^^%NLM%%NLM%^%NLM%%NLM%
echo Windows Registry Editor Version 5.00 > %1/scanned.reg
echo. >> %1/scanned.reg
set regq= REG QUERY HKLM /v SelectiveSuspendFeatureOn /s %curuser%
for /f "tokens=* delims=\\n" %%A IN ('%regq% ^| findstr /i "HKEY_LOCAL_MACHINE"') DO echo [%%A] >> %1/scanned.reg & echo "SelectiveSuspendFeatureOn"=dword:00000000 >> %1/scanned.reg & echo. >> %1/scanned.reg
set regq= REG QUERY HKLM /v EnableSelectiveSuspend /s %curuser%
for /f "tokens=* delims=\\n" %%A IN ('%regq% ^| findstr /i "HKEY_LOCAL_MACHINE"') DO echo [%%A] >> %1/scanned.reg & echo "EnableSelectiveSuspend"=dword:00000000 >> %1/scanned.reg & echo. >> %1/scanned.reg
regedit.exe /S %1/scanned.reg
exit
所以这个是扫描Windows注册表,然后将这些值保存为.reg键并最终运行.reg文件以应用更改。
注册udpates后 - 需要重新启动系统。
这个有争论"路径"添加所以你应该运行这个带有参数的.bat例如" C:"或任何其他路径。
答案 0 :(得分:0)
我设法创建了我需要的逻辑:
@echo off
cls
:startreg
cls
echo Scanning computer in order to apply Power Managment adjustments for USB readers
echo Windows Registry Editor Version 5.00 > %1/scanned.reg
echo. >> %1/scanned.reg
set regq= REG QUERY HKLM /v SelectiveSuspendFeatureOn /s %curuser%
for /f "tokens=* delims=\\n" %%A IN ('%regq% ^| findstr /i "HKEY_LOCAL_MACHINE"') DO echo [%%A] >> %1/scanned.reg & echo "SelectiveSuspendFeatureOn"=dword:00000000 >> %1/scanned.reg & echo. >> %1/scanned.reg
set regq= REG QUERY HKLM /v EnableSelectiveSuspend /s %curuser%
for /f "tokens=* delims=\\n" %%A IN ('%regq% ^| findstr /i "HKEY_LOCAL_MACHINE"') DO echo [%%A] >> %1/scanned.reg & echo "EnableSelectiveSuspend"=dword:00000000 >> %1/scanned.reg & echo. >> %1/scanned.reg
regedit.exe /S %1/scanned.reg
exit
所以这个是扫描Windows注册表,然后将这些值保存为.reg键并最终运行.reg文件以应用更改。
注册udpates后 - 需要重新启动系统。
这个有争论"路径"添加所以你应该运行这个带有参数的.bat例如" C:"或任何其他路径。