Need a script to check registry key value existing or not

Question

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

in progress 0
Akash Thapa 1 month 3 Answers 62 views Beginner 0

Answers ( 3 )

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

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

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

    @echo 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 – https://docs.microsoft.com/en-us/powershell/scripting/samples/working-with-registry-entries?view=powershell-6

Leave an answer

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