求,如何利用批处理提取如下注册表的路径给一个临时变量?谢谢!

2024-11-20 04:56:07
推荐回答(1个)
回答1:

试试下面的代码
@echo off&setlocal enabledelayedexpansion
for /f "tokens=1 delims=:" %%a in ('"reg query "hkey_local_machine\system\currentcontrolset\enum\ide" /s|findstr /n "UserWriteCacheSetting""') do set /a num=%%a
set /a num=num-1
for /f "tokens=2 delims=:" %%i in ('"reg query "hkey_local_machine\system\currentcontrolset\enum\ide" /s|findstr/n .|findstr /b "%num%""') do set pa=%%i
echo !pa!