paupau90
Goto Top

Wie stellt man eine IF-Abfrage für einen DWORD Wert eines Registryeintrags in einem Batch Skript?

Hallo,
ich will in einem Batch Skript eine IF-Abfrage für einen DWORD Wert eines Registrieintrags starten. Wie mache ich das?

reg query "HKLM\SOFTWARE\..." /v "Example"  
if %Example%=="0x1" ... else ...  

Content-Key: 305000

Url: https://administrator.de/contentid/305000

Printed on: April 18, 2024 at 01:04 o'clock

Mitglied: 129413
129413 May 20, 2016 updated at 11:10:06 (UTC)
Goto Top
z.B. so
reg query "HKEY_CURRENT_USER\Software\...." /v "Example" | findstr /ic:"0x1" >nul 2>&1 && (  
  echo OK
) || (
   echo Nicht OK
)
oder auch
for /f "tokens=3" %%a in ('reg query "HKEY_CURRENT_USER\Software\..." /v "Example" ^| findstr /ic:"Example"') do set "wert=%%a"  
if "%wert%" == "0x1" .....  
Gruß skybird
Member: Endoro
Endoro May 22, 2016 updated at 08:12:09 (UTC)
Goto Top
Hey,

es sollte auch einfach so gehen:
for /f "tokens=3" %%a in ('REG QUERY HKLM\Software\Microsoft\Windows\CurrentVersion\Audio /v VolumeRepeatWindow') do set "DWORD=%%~a"  
echo %DWORD%

Gruß, Endoro