2013-10-25 97 views
11

我有以下查詢 -從批處理文件查詢註冊表時,我可以查詢數據嗎?

@ECHO OFF 
REG QUERY "HKEY_CURRENT_USER\Software\Microsoft\Microsoft Games\Flight Simulator\10.0" /v AppPath 
PAUSE 

這將返回名稱,類型和條目,如下面的數據 -

HKEY_CURRENT_USER\Software\Microsoft\Microsoft Games\Flight Simulator\10.0 
    AppPath REG_SZ C:\Program Files (x86)\Microsoft Games\Microsoft Flight Simulator X\ 

Press any key to continue . . . 

難道只能檢索到的數據部分的註冊表項?

回答

28
for /f "tokens=2*" %%a in ('REG QUERY "HKEY_CURRENT_USER\Software\Microsoft\Microsoft Games\Flight Simulator\10.0" /v AppPath') do set "AppPath=%%~b" 
echo %AppPath% 
pause 
+0

THANK YOU SOOOOO MUCH !!!! – user2755744

+0

@ user2755744 - 至少接受他的回答.... – npocmaka

+0

這會導致無限循環並在應用程序運行時崩潰。 – nateirvin

-2

感謝您的回答,在這裏除了能夠然後將字符串添加到一個值:

for /f "tokens=2*" %%a in ('REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\...." /v keyname') do set "AppPath=%%~b" 
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\..." /v "keyname" /f /t REG_SZ /d "%AppPath% appended value" 
相關問題