Autodesk Technology Managers Forum
Share your knowledge, ask questions, and engage with fellow CAD/BIM Managers.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

how to detect reg entry using batch file?

3 REPLIES 3
Reply
Message 1 of 4
Anonymous
1222 Views, 3 Replies

how to detect reg entry using batch file?

in my login script, which is a .cmd file, I want to do something based on if a particular registry entry exists.
Is there a way to do this?

I was thinking of making a tool to create a text file in some folder if the entry exists, then use IF EXIST
(...) in my batch file.

thanks in advance.
James Maeding
Civil Engineer and Programmer
jmaeding - at - hunsaker - dotcom
3 REPLIES 3
Message 2 of 4
Anonymous
in reply to: Anonymous

The REGREAD method works with windows scripting

http://msdn.microsoft.com/en-us/library/x05fawxd(VS.85).aspx

Otherwise KIX32 or AUTOIT scripting can read/modify registry entries.

Mark Evinger

"James Maeding" wrote in message
news:6115653@discussion.autodesk.com...
in my login script, which is a .cmd file, I want to do something based on if
a particular registry entry exists.
Is there a way to do this?

I was thinking of making a tool to create a text file in some folder if the
entry exists, then use IF EXIST
(...) in my batch file.

thanks in advance.
James Maeding
Civil Engineer and Programmer
jmaeding - at - hunsaker - dotcom
Message 3 of 4
Anonymous
in reply to: Anonymous

On Sat, 31 Jan 2009 00:24:30 +0000, James Maeding
wrote:

>in my login script, which is a .cmd file, I want to do something based on if a particular registry entry exists.
>Is there a way to do this?
>
>I was thinking of making a tool to create a text file in some folder if the entry exists, then use IF EXIST
>(...) in my batch file.

I use REG QUERY in conjunction with the ERRORLEVEL system variable.

For example, let's say I want to uninstall Autodesk DWG TrueConvert. I would see
if it is installed by querying the Install key for that product, then if
ERRORLEVEL is 0 (i.e., it is intalled,) I would uninstall it:

@echo off
set pth=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall

echo Checking/Removing Autodesk DWG TrueConvert...
reg query "%pth%\{5783F2D7-0221-0409-0000-0060B0CE6BBA}"
if %errorlevel%==0 msiexec.exe /x{5783F2D7-0221-0409-0000-0060B0CE6BBA} /passive

Matt
matt@stachoni.com
Message 4 of 4
Anonymous
in reply to: Anonymous

Ah, very nice Matt!
Thanks for both replies guys.

Matt Stachoni
|>On Sat, 31 Jan 2009 00:24:30 +0000, James Maeding
|>wrote:
|>
|>>in my login script, which is a .cmd file, I want to do something based on if a particular registry entry exists.
|>>Is there a way to do this?
|>>
|>>I was thinking of making a tool to create a text file in some folder if the entry exists, then use IF EXIST
|>>(...) in my batch file.
|>
|>I use REG QUERY in conjunction with the ERRORLEVEL system variable.
|>
|>For example, let's say I want to uninstall Autodesk DWG TrueConvert. I would see
|>if it is installed by querying the Install key for that product, then if
|>ERRORLEVEL is 0 (i.e., it is intalled,) I would uninstall it:
|>
|>@echo off
|>set pth=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
|>
|>echo Checking/Removing Autodesk DWG TrueConvert...
|>reg query "%pth%\{5783F2D7-0221-0409-0000-0060B0CE6BBA}"
|>if %errorlevel%==0 msiexec.exe /x{5783F2D7-0221-0409-0000-0060B0CE6BBA} /passive
|>
|>Matt
|>matt@stachoni.com
James Maeding
Civil Engineer and Programmer
jmaeding - at - hunsaker - dotcom

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Administrator Productivity


Autodesk Design & Make Report