?
Solved

DOS batch file to determine Windows 2000 version

Posted on 2007-12-04
3
Medium Priority
?
2,588 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 26

Accepted Solution

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

Assisted Solution

by:Bozwell99
Bozwell99 earned 500 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

7 Extremely Useful Linux Commands for Beginners

Just getting started with Linux? Here's a quick start guide that has 7 commands that we believe will come in handy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is a collection of issues that people face from time to time and possible solutions to those issues. I hope you enjoy reading it.
This article provides a convenient collection of links to Microsoft provided Security Patches for operating systems that have reached their End of Life support cycle. Included operating systems covered by this article are Windows XP,  Windows Server…
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…

770 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