Quantcast

Maximum PC

It is currently Wed Aug 20, 2014 10:41 pm

All times are UTC - 8 hours




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: this registry command line is a batch
PostPosted: Wed Jul 21, 2004 11:55 am 
8086
8086

Joined: Sun Jun 27, 2004 7:33 pm
Posts: 20
it all seems so simple in my head...

I have a certain version of an application installed, which appears in add remove programs. we all know that add remove programs is no more than registry files displayed all farncy.

MY GOAL: to compare a string value in one registry string 'DisplayVersion' to a value i have set as a variable in the batch file. If the values do not match, then run the uninstall file.

I've tried regedit.exe commands, reg.exe commands... even other programs, but i can't figure out how to do it! Seems like i have to compare full keys instead of simply string values, which i couldn't even get right.

If you know how to retrieve the value of a registry string value and compare it against a batch variable please lmk... i will be very grateful.


Top
  Profile  
 
 Post subject: Re: this registry command line is a batch
PostPosted: Wed Jul 21, 2004 1:28 pm 
8086
8086

Joined: Thu Jul 15, 2004 11:30 am
Posts: 89
Location: Sterling Heights, MI
Here is a website that appears to have examples of what you want.

If that doesn't work for you, can you post an example of the batch file you have and what it is supposed to do?


Top
  Profile  
 
 Post subject:
PostPosted: Wed Jul 21, 2004 6:22 pm 
8086
8086

Joined: Sun Jun 27, 2004 7:33 pm
Posts: 20
i have seen that site and several thing i've tried from it have worked; however, the big problem comes with the comparison. Heres an example:

The Blah application has a key in HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Blah\

which is a string of type REG_SZ which is named "DisplayVersion" = "13.00.0000".
along with many other strings, none of which are relevant to this scenario.

I have to distribute a new version (14.00.0000) of the application to a number of PCs, so i want to create a batch file which checks to see if the value of that particular string (DisplayVersion) is, in fact, equal to 14.00.0000 - if it is not i can work from there. My problem is using the command line to somehow get the value of that single string for comparison... getting that single string into the batch file so i can check to see if it IS the same as 14.00.000 is my issue. Hope that helps...


Top
  Profile  
 
 Post subject:
PostPosted: Thu Jul 22, 2004 7:48 am 
8086
8086

Joined: Sun Jun 27, 2004 7:33 pm
Posts: 20
another thing i'm now trying to do in addition to that is to automatically change the NIC settings using netsh... i need to change the duplex to 10/full (don't ask... thats just how it has to be lol). i've been fishing around in it but havent found anything yet... its an Intel pro 10/100 NIC.


Top
  Profile  
 
 Post subject:
PostPosted: Thu Jul 22, 2004 7:53 am 
8086
8086

Joined: Sun Jun 27, 2004 7:33 pm
Posts: 20
i was thinking maybe this chunk had to do with the duplex setting, most specifically the starred line:

# IP Configuration
pushd routing ip
reset
set loglevel error
add preferenceforprotocol proto=LOCAL preflevel=1
**********************************************
add preferenceforprotocol proto=NetMgmt preflevel=10
**********************************************
add preferenceforprotocol proto=STATIC preflevel=3
add preferenceforprotocol proto=NONDOD preflevel=5
add preferenceforprotocol proto=AUTOSTATIC preflevel=7
add preferenceforprotocol proto=OSPF preflevel=110
add preferenceforprotocol proto=RIP preflevel=120
add interface name="{52E7DCA0-B478-428A-A863-8D7B43782986}" state=enable
set filter name="{52E7DCA0-B478-428A-A863-8D7B43782986}" fragcheck=disable
add interface name="Local Area Connection" state=enable
set filter name="Local Area Connection" fragcheck=disable
add interface name="Internal" state=enable
set filter name="Internal" fragcheck=disable
add interface name="Loopback" state=enable
set filter name="Loopback" fragcheck=disable
popd
# End of IP configuration


Top
  Profile  
 
 Post subject:
PostPosted: Thu Jul 22, 2004 10:45 am 
8086
8086

Joined: Thu Jul 15, 2004 11:30 am
Posts: 89
Location: Sterling Heights, MI
[quote="virtualchaos"]HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Blah\

I'm showing the key would be more like

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{01BDFB08-EE88-4E5E-94A6-AE9EDCFA40C5}]

Here is a direct link to theUsing REGEDIT

At the very bottom of the page is: The following example, GETRES.BAT (Version 3.00) for Windows NT 4/2000, also demonstrates how to read and parse registry settings using REGEDIT:

That is what you're looking for. You need to modify the code to do what you want to do.


Top
  Profile  
 
 Post subject:
PostPosted: Sat Jul 24, 2004 5:57 pm 
8086
8086

Joined: Sun Jun 27, 2004 7:33 pm
Posts: 20
okay, so using this type of form:

FOR /F "tokens=1* delims==" %%A IN ('TYPE %Temp%.\international.reg ^¦ FIND "iCountry"') DO SET iCountry=%%B
SET iCountry=%iCountry:"=%

how would i find the number 1.03 in a registry file? I know how to export the reg file, but the for loop syntax does so much in DOS it gets quite confusing...

I'd be looking to see if there was an instance of the number 1.03 in the batch file so itd be something like:

:: find number of instances 1.03 is found
find /c 1.03 temporaryReg.txt

this returns this kind of thing:
------ %temp%\temporaryReg.txt: 1

the problem is isolating the one... i'm used to returns from subroutines and class methods, not really this strange syntactical stuff... i guess thats what makes this so hard!


Top
  Profile  
 
 Post subject:
PostPosted: Tue Jul 27, 2004 1:01 pm 
8086
8086

Joined: Sun Jun 27, 2004 7:33 pm
Posts: 20
okay, i figured out how to fix both issues. (yay me!)

in order to find the number in the registry file i just used the errorlevel supplied by the find command... if it doesn't find the string you're looking for the %errorlevel%==1, otherwise it is zero.

secondly, in the registry microsoft likes to keep EVERYTHING. yes, thats right, even your NIC settings. That was how i changed the duplex... its something like hklm\system\controlset001\control\class\{4D36E972-E325-11CE-BFC1-08002bE10318}\0001\SpeedDuplex , but it may vary for you... it may be in \ndi\params as well. feel free to mess around with it, you cant really hurt it too bad, just download an OEM driver before you start.

in terms of changing registry values i used this program called regFREE, it works real well.


Top
  Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group