Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

DOS batch file to determine Windows 2000 version

Posted on 2007-12-04
3
Medium Priority
?
2,597 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This article helps those who get the 0xc004d307 error when trying to rearm (reset the license) Office 2013 in a Virtual Desktop Infrastructure (VDI) and/or those trying to prep the master image for Microsoft Key Management (KMS) activation. (i.e.- C…
An introduction to the wonderful sport of Scam Baiting.  Learn how to help fight scammers by beating them at their own game. This great pass time helps the world, while providing an endless source of entertainment. Enjoy!
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

610 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