Unoffical empeg BBS

Quick Links: Empeg FAQ | RioCar.Org | Hijack | BigDisk Builder | jEmplode | emphatic
Repairs: Repairs

Topic Options
#326640 - 12/10/2009 16:49 DOS Batch file help -- Determining Windows Server or Client OS
tfabris
carpal tunnel

Registered: 20/12/1999
Posts: 31578
Loc: Seattle, WA
ver | find "5.2." > NUL
if NOT ERRORLEVEL 1 set MyWindowsVer=Server2k3
ver | find "6.1." > NUL
if NOT ERRORLEVEL 1 set MyWindowsVer=Win7
ver | find "6.0." > NUL
if NOT ERRORLEVEL 1 set MyWindowsVer=Vista
ver | find "5.1." > NUL
if NOT ERRORLEVEL 1 set MyWindowsVer=XP

Only problem is that 6.0 counts for both Vista and for Server2008. How to differentiate the two from within a DOS batch file?
_________________________
Tony Fabris

Top
#326641 - 12/10/2009 17:11 Re: DOS Batch file help -- Determining Windows Server or Client OS [Re: tfabris]
tman
carpal tunnel

Registered: 24/12/2001
Posts: 5528
systeminfo?

Code:
OS Name:                   Microsoft Windows 7 Ultimate

Top
#326642 - 12/10/2009 17:30 Re: DOS Batch file help -- Determining Windows Server or Client OS [Re: tman]
tfabris
carpal tunnel

Registered: 20/12/1999
Posts: 31578
Loc: Seattle, WA
Hee. It works but it's weird.

C:\Users\Username>systeminfo
Host Name: HOSTNAME
OS Name: Microsoftr Windows Serverr 2008 Standard
OS Version: 6.0.6001 Service Pack 1 Build 6001

Note the extra "r"s

heh.
_________________________
Tony Fabris

Top
#326643 - 12/10/2009 17:49 Re: DOS Batch file help -- Determining Windows Server or Client OS [Re: tfabris]
tman
carpal tunnel

Registered: 24/12/2001
Posts: 5528
Originally Posted By: tfabris
Hee. It works but it's weird.

C:\Users\Username>systeminfo
Host Name: HOSTNAME
OS Name: Microsoftr Windows Serverr 2008 Standard
OS Version: 6.0.6001 Service Pack 1 Build 6001

Note the extra "r"s

heh.

Hmm... Maybe its the registered trademark symbol? I don't get it on W7.

Top
#326645 - 12/10/2009 19:41 Re: DOS Batch file help -- Determining Windows Server or Client OS [Re: tman]
tfabris
carpal tunnel

Registered: 20/12/1999
Posts: 31578
Loc: Seattle, WA
It's definitely the registered trademark symbol, and yes, it doesn't happen in Vista or Win7.

I'm not sure if it's an R1 or R2 or SP1 etc thing or not, I don't have that many Server 2008 boxes to test against. I just thought it was funny.
_________________________
Tony Fabris

Top
#326647 - 12/10/2009 20:20 Re: DOS Batch file help -- Determining Windows Server or Client OS [Re: tfabris]
drakino
carpal tunnel

Registered: 08/06/1999
Posts: 7868
Also keep in mind 5.2 is Windows XP 64 bit.

Top
#326648 - 12/10/2009 21:16 Re: DOS Batch file help -- Determining Windows Server or Client OS [Re: drakino]
tfabris
carpal tunnel

Registered: 20/12/1999
Posts: 31578
Loc: Seattle, WA
Thanks, that's nice to know.
_________________________
Tony Fabris

Top
#326654 - 13/10/2009 05:51 Re: DOS Batch file help -- Determining Windows Server or Client OS [Re: tfabris]
Roger
carpal tunnel

Registered: 18/01/2000
Posts: 5682
Loc: London, UK
Code:
C:\>reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion
    EditionID    REG_SZ    ServerStandard


On Windows Server 2008 Standard Edition SP2. Windows 7 RC just says "Ultimate".
_________________________
-- roger

Top
#326655 - 13/10/2009 05:52 Re: DOS Batch file help -- Determining Windows Server or Client OS [Re: drakino]
Roger
carpal tunnel

Registered: 18/01/2000
Posts: 5682
Loc: London, UK
Originally Posted By: drakino
Also keep in mind 5.2 is Windows XP 64 bit.


Yeah, Windows XP 64 is basically just Windows 2003 SP2. That was when they got the two streams back together, so that Windows Vista is Windows 2008 and Windows 7 is Windows 2008 R2.
_________________________
-- roger

Top