reg query an item
Posted: 04 Oct 2013 05:56
Hi everyone...
This question has been answered so many time but I can't find the correct code.
I have this setup:
Which was provide by aGerman.
So I want to check if a reg item exists without it prompting that it does not exist, if it doesn't.
The errorlevel variable stays at always 0. How can I change this?
The reg query is to check if it does exist and the if statement will read the item's data if it does exist, but the errorlevel stays the same.
Therefore it throws and error if it does not exist.
How can I fix this? I can't put the >nul 2>nul on the if statement can I?
Any help?
This question has been answered so many time but I can't find the correct code.
I have this setup:
Code: Select all
reg query "%RegKey%" /v "DISCLAIMER_UI" >nul 2>nul
echo %errorlevel%
pause
if "%errorlevel%"=="0" for /f "tokens=2*" %%i in ('reg query "%RegKey%" /v "DISCLAIMER_UI"') do set "DisclaimerUI=%%j"
Which was provide by aGerman.
So I want to check if a reg item exists without it prompting that it does not exist, if it doesn't.
The errorlevel variable stays at always 0. How can I change this?
The reg query is to check if it does exist and the if statement will read the item's data if it does exist, but the errorlevel stays the same.
Therefore it throws and error if it does not exist.
How can I fix this? I can't put the >nul 2>nul on the if statement can I?
Any help?