Link to home
Start Free TrialLog in
Avatar of zawa
zawa

asked on

Simple: detect OS and SP

Hi,


I need a batch file to detect what is the OS and Service Pack the pc has on and save the OS in the variable %os and the SP in the variable %sp


Thanks
ASKER CERTIFIED SOLUTION
Avatar of graye
graye
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Lee W, MVP
Lee W, MVP
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I feel all three comments answer the question, though ShaneKelly has a valid point about the %OS% variable and graye's comment did attempt to reset that.  

I believe my solution represents the best answer where the OS is NT, 2000, or XP.  I do not believe systeminfo functions in NT.  And the VBScript solution is both longer and requires the computer have VSH installed and running (NT 4 might be an issue with this).  

Regardless, I think the points should be split evenly amongst the three of us.