# registry check using .BAT file

## Recommended Posts

softengg    100
Hi, I want to check a value in the registry using a batch file...(It is actually checking whether a software is installed or not). If that value exists, i want to quit the batch file. If that value not found, it will execute another .exe from a folder. How this is possible using a batch file........please help me....... Thanks in advance....

##### Share on other sites
Evil Steve    2017
Something like this seems to work:
@echo offreg query HKCU\Software\Winampif errorlevel 1 goto not_existgoto exit:not_existprogram_name_to_run:exit

Where "HKCU\Software\Winamp\" is obviously the key to query, and program_name_to_run is the name of the program to run if the key doesn't exist.

Although, why do you want to do this from a batch file rather than the exe itself?

##### Share on other sites
Captain P    1092
Googling for 'batch file registry' should give you some ideas. It looks like you'll have to call regedit.exe or reg.exe to do the registry job for you, but what you want seems doable.

EDIT: Beaten to it. :)