CMD (Bat) file -read reg value -> and take action

I'm looking for a way in a script fil to read a registry value and depend on the value there run a exe file.

Somthing like

Start "c:\program files\maypp1.exe"
Start "c:\program files\maypp2.exe"

The value is type=text (if that matter)


Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

I had the same thing to do a while ago, read into the registry.  In order to do that, I Used a VB Script instead of a bacth file.

Simply create a text file, copy this code in, modify it to fit your needs and save it to "MyScript.vbs" (Whatever the name, as long as it's a .vbs file ;) )


Dim RegValue
Dim WshShell
Set net = CreateObject("WScript.Network")
Set WshShell = WScript.Createobject("")


IF RegValue = "3.0.1" Then
   WshShell.Run "C:\Program Files\MyApp1.exe"
   WshShell.Run "C:\Program Files\MyApp2.exe"
End IF

Set WshShell = Nothing


That should do the trick!!


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Lee W, MVPTechnology and Business Process AdvisorCommented:
Assuming you are using 2000 or XP you can use the "REG.EXE" command to read the registry.  Then parse it with FOR and/or FIND.  (if 2000, the REG.EXE command is in the support tools on the CD.  Otherwise XP includes it).  Type REG /?  for more info on using the command
peroveAuthor Commented:
thanks steph..

(/neede to change the /slash to backslash \ )

If you can use VBscript then above script is ideal...
and if u have to use command-line based tool then

The following links shows how you can use REG.EXE from NT resource kit within batch file and take a action according to the result...
peroveAuthor Commented:
kapes & leew ..Great
think vbscrip will do the trick for me but I will indeed have that in mind..
thanks again

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Languages and Standards

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.