check registry key [solved]

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
abc0502
Posts: 1007
Joined: 26 Oct 2011 22:38
Location: Egypt

check registry key [solved]

#1 Post by abc0502 » 14 Mar 2012 19:15

Is it possible to check for a key in the registry
like in this: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
to check if the "RUN" exist or not

i use this for values:

Code: Select all

@echo off
cls
set reg=HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
::===Code===::
REG QUERY "%reg%" /v "utorrent" /s >nul
if %errorlevel%==0 ( echo utorrent Exist
) Else ( echo utorrent Not Exist)

how to check if the "RUN" Key Exist ?? thanks in advance
Last edited by abc0502 on 14 Mar 2012 19:49, edited 1 time in total.

aGerman
Expert
Posts: 4654
Joined: 22 Jan 2010 18:01
Location: Germany

Re: check registry key

#2 Post by aGerman » 14 Mar 2012 19:33

The same way but without the options.

Code: Select all

REG QUERY "%reg%" >nul 2>&1

Check the errorlevel state.

Regards
aGerman

abc0502
Posts: 1007
Joined: 26 Oct 2011 22:38
Location: Egypt

Re: check registry key

#3 Post by abc0502 » 14 Mar 2012 19:49

Thnaks for the quick respond it work fine :D

Post Reply