Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Batch File

Status
Not open for further replies.

justagirl

Technical User
Nov 7, 2003
2
GB
Wasn't sure in what forum to place this question, if wrong place please suggest where.

Need to create a batch file which I can run from a single point on the network (will be run from the client end). The basic idea is the batch file looks up the windows version (will either be 98 or 2000) and copies the relevent files down to the client computer and executes a further batch file.

Now have no problems create most of the batch file, its just how do I get the windows version and use this info in the batch file??

Tried browsing the web but got nowhere fast
 
In the registry, you can extract the key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProductName

Might be HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\ProductName for older versions of Windows.

Don't exactly know how to extract the data from there, but at least now you know where to find it.

Good luck!
 
why not use the "ver" command?
once you have the results just do an IF statement to copy to the relevant machine type.
have you tried that?
 
I use vbscript instead of batch. This should work to get the key that Palagast reccomended.

Dim WshShell, bKey
Set WshShell = WScript.CreateObject("WScript.Shell")


bKey = WshShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProductName
")
WScript.Echo WshShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProductName
")

paste into notepad and save it as filename.vbs

q

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top