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 8 months 2020-10-23T15:09:23+05:30 3 Answers 79 views Beginner 0

Answers ( 3 )

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

    0
    2020-10-27T06:46:42+05:30

    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 :-

    @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 .