Solved

DOS batch file to determine Windows 2000 version

Posted on 2007-12-04
3
2,578 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 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

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...
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

733 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