Solved

DOS batch file to determine Windows 2000 version

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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

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…
Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
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…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

696 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