Solved

DOS batch file to determine Windows 2000 version

Posted on 2007-12-04
3
2,538 Views
Last Modified: 2010-04-21
I came across this DOS batch file in my search for a way to determine the Windows version:

@echo off

ver | find "2003" > nul
if %ERRORLEVEL% == 0 goto ver_2003

ver | find "XP" > nul
if %ERRORLEVEL% == 0 goto ver_xp

ver | find "2000" > nul
if %ERRORLEVEL% == 0 goto ver_2000

ver | find "NT" > nul
if %ERRORLEVEL% == 0 goto ver_nt

echo Machine undetermined.
goto exit

:ver_2003
:Run Windows 2003-specific commands here.
echo Windows 2003
goto exit

:ver_xp
:Run Windows XP-specific commands here.
echo Windows XP
goto exit

:ver_2000
:Run Windows 2000-specific commands here.
echo Windows 2000
goto exit

:ver_nt
:Run Windows NT-specific commands here.
echo Windows NT
goto exit

:exit
pause

I haven't found out yet whether or not Vista can be included in the script.

However, to me this is not important in this specific situation. I only need to know if people are running Windows 2000 or not so I can probably just delete the other versions, which thereby will de directed to "Machine undetermined".

But it would be nice to expand the script to also distinguise between:

2000 Professional
2000 Server
2000 Advanced Server
2000 Datacenter Server

Does anyone have an idea how to make that work? I tried adding the word "Professional" and the number "5.00.2195" in the batch file, but that didn't work ("Machine undetermined").

Greetings

Sebastian
0
Comment
Question by:sebastianemborg
3 Comments
 
LVL 26

Accepted Solution

by:
souseran earned 125 total points
ID: 20404537
0
 
LVL 2

Assisted Solution

by:Bozwell99
Bozwell99 earned 125 total points
ID: 20404572
If you know the specific version number that that you want you can do it like this:

VER | find "Windows [Version 5.2.3790]" > nul

for Windows Server 2003 SP1, or:

VER | find "XP [Version 5.1.2600]" > nul

for Windows XP SP1

I don't have a Windows 2000 server to test on, but these work with My XP and 2003 PCs. Basically whatever appears when you use the 'VER' command on a PC is what you use for the version name you are looking for.
0
 

Author Closing Comment

by:sebastianemborg
ID: 31412622
You both proved very helpful, thank you. Adding "5.00.2195" did the trick.
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Sometimes drives fill up and we don't know why.  If you don't understand the best way to use the tools available, you may end up being stumped as to why your drive says it's not full when you have no space left!  Here's how you can find out...
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now