Question : version bat file

I am looking for a bat file that looks for xp sp2, if it finds, go to end: if not run this   install xpsp2.bat

Answer : version bat file

Try this:

@Echo Off
Ver | Find "XP" > NUL
If %ErrorLevel% EQU 0 Goto :XPInst
Echo XP NOT Installed
Goto :EOF

:XPInst
Reg Query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v CSDVersion | Find "Service Pack 2" > NUL
If %ErrorLevel% EQU 0 (
      Echo XP SP2 Installed
) Else (
      Echo XP Installed - NOT SP2
)



As an aside, if the build number changed you could just check for .2600 in the VER command (I only have an SP2 box and I can't remember what the old version number was, but I'm pretty sure it was different).

HTH,

Wallsy
Random Solutions  
 
programming4us programming4us