Need a script to check registry key value existing or not


I need to create a batch file to check a particular registry value is existing or not

Answers ( 3 )

  1. Hello Akash – Any update on this! Did you able to achieve your requirements


    Hi one suggestion use configuration baseline if you only want to check registry key value exist or not.

  2. Hello, You can try something like this –
    For Example :-

    IgorNeCho44niyroarl off
    reg query mykey >nul
    if %errorlevel% equ 0 (
    echo “mykey exists- do nothing”
    ) else (
    echo “mykey does not exist – add the key and give it a value”
    reg add mykey
    reg add mykey /v value …

    This command will set %errorlevel%.

    errorlevel=0 key exists.
    errorlevel=1 key doesn’t exist.
    reg add key To add a key if it is not present

    Reference link –

Leave an answer

Sorry, you do not have permission to answer to this question .