When querying the registry from a batch file, can I query the Data?

前端 未结 3 1035
梦如初夏
梦如初夏 2020-12-10 03:32

I have the following query -

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


        
相关标签:
3条回答
  • 2020-12-10 03:55

    Thanks for the answer, here an addition to be able then to append a string to a value:

    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"
    
    0 讨论(0)
  • 2020-12-10 03:57
    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 讨论(0)
  • 2020-12-10 04:10

    Bellow command does work, For example I want to get OS name :

    for /f "tokens=2*" %%a in ('reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v ProductName ^| findstr "REG_"') do @echo %%b
    

    The output is :

    Windows 10 Enterprise
    
    0 讨论(0)
提交回复
热议问题