Computing.Net > Forums > Programming > Batch f or vbs; verify a registry k

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Batch f or vbs; verify a registry k

Reply to Message Icon

Name: martinmim
Date: November 30, 2006 at 07:37:29 Pacific
OS: xp
CPU/Ram: p4, 1g
Product: ibm
Comment:

I want to create a batch file or vbs.
here is the thing I want to do
1)verify if a specific reg key is in the registry.
2)If it's there, exit
3)if not lauch a batch file

Is it possible to do that?

thanks for your help.




Sponsored Link
Ads by Google

Response Number 1
Name: IVO
Date: November 30, 2006 at 07:51:02 Pacific
Reply:

Yes, it is possible

@Echo Off

Reg Query <key-structure>
If not ErrorLvel 1 GoTo :EOF
NewBatch

Where NewBatch is the batch to be launched and to set >key-structure> follow the help displayed typing Reg Query /?.


0

Response Number 2
Name: Mechanix2Go
Date: November 30, 2006 at 08:10:33 Pacific
Reply:

Hi IVO,

When I type:

Reg Query /?

in w2k, I get the good old:

'reg' is not recognized as...



=====================================
If at first you don't succeed, you're about average.

M2



0

Response Number 3
Name: IVO
Date: November 30, 2006 at 08:44:08 Pacific
Reply:

Salve M2,

very strange as the line command Reg.exe is standard since Windows 2000 and many tools delivered in Win 2K lack in Win XP on the contrary.

See the following link for more info

http://www.robvanderwoude.com/index...

and may be you like the site too.

Any way the owner of the thread declares running under XP.


0

Response Number 4
Name: martinmim
Date: November 30, 2006 at 08:59:46 Pacific
Reply:

ok I create that:

@Echo Off

Reg Query <HKCU\Software\martin>
If not ErrorLevel 1 GoTo :EOF
2.bat

nothing append, I see the command windows open really quick an thats it


0

Response Number 5
Name: IVO
Date: November 30, 2006 at 11:50:34 Pacific
Reply:

Well if the windows opened and closed in an eyes wide shut, the key you was looking for exists and the batch ended without launching 2.bat.

To proof that slightly modify the batch

Reg Query <HKCU\Software\martin>
Echo.ErrorLevel=%ErrorLevel%
Pause
If not ErrorLevel 1 GoTo :EOF
2.bat

If you get ErrorLevel=0 the GoTo :EOF statrment is executed and the batch terminated.

I hope your system has the reg.exe command.


0

Related Posts

See More



Response Number 6
Name: IVO
Date: November 30, 2006 at 11:53:54 Pacific
Reply:

And avoid to embrace the key by <>.

Did you see the /? Help, as I suggested?


0

Response Number 7
Name: IVO
Date: November 30, 2006 at 12:01:02 Pacific
Reply:

Hello M2,

if you are interested in Reg.exe donwload it from

http://www.petri.co.il/reg_command_...


0

Response Number 8
Name: martinmim
Date: November 30, 2006 at 12:34:32 Pacific
Reply:

Thank you for your help IVO, actually it was the <> that i forgot to remove.


0

Response Number 9
Name: Mechanix2Go
Date: November 30, 2006 at 22:40:27 Pacific
Reply:

Thanks, IVO

Got REG and some other tools.


=====================================
If at first you don't succeed, you're about average.

M2



0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Batch f or vbs; verify a registry k

delete a registry key with batch? www.computing.net/answers/programming/delete-a-registry-key-with-batch/8218.html

Sending varible to a batch from vbs www.computing.net/answers/programming/sending-varible-to-a-batch-from-vbs/5344.html

Batch file or registry value? www.computing.net/answers/programming/batch-file-or-registry-value-/12331.html