Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsWindows VistaWindows XPWindows MeWindows 98Windows 95Virtual PCInternet ExplorerOutlook ExpressWindows MediaSecurity
Related Topics
MS Server ProductsMS OfficePC HardwareMore Topics ...

Windows Forum / Windows 95 / March 2004

Tip: Looking for answers? Try searching our database.

Dos Batch File to check Windows Version

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Barry Davidson - 10 Mar 2004 11:54 GMT
I need to write a batch files that checks what version of
Windows the user is running...i.e Win95 or Windows 2000
etc dependent on the OS that the user is runing I then
need the batch file to jump to a different set of
instructions within the batch file dependent on the OS.
No idea where to post this question but can anyone point
me in the right direction please.
Many Thanks
cquirke (MVP Win9x) - 12 Mar 2004 10:12 GMT
On Wed, 10 Mar 2004 03:54:51 -0800, "Barry Davidson"

>I need to write a batch files that checks what version of
>Windows the user is running...i.e Win95 or Windows 2000

There are some cues you can use:

1)  Examine environment variables

NT creates and populates a variable that defines the Windows version;
Win9x does not.  This test will then fail on syntax...

  If %labelname%==value ...

...whereas this "safe" syntax will pass:

  If "%labelname%"=="value" ...

I can't look up the actuals for "labelname" and "value" right now.

When Win9x runs in GUI mode, it defines %WinDir%; when running in DOS
mode, it does not.  So you can detect whether a Win9x is running in
Windows or in DOS mode via this test:

  If "%WinDir%"==""  GoTo WeAreInDOSMode

NT also defines several other environment variables, which you'd
expect to be nul in the case of Win9x; %userprofile% etc.  Don't test
for specific values to decide you are in an NT; test for nul values to
decide you are not in NT (as per %WinDir% example above).

2)  Look for key files

Each OS may have files that other versions do not, and you can test
for existence of these.  That tells you what OS is installed, but not
which OS is running (in the event of dual OSs).  Caveats:
 - NTFS permissions and Attribute issues may confound tests
 - use %WinDir% or similar to cater for non-default paths

HTH

>-------------------- ----- ---- --- -- - -  -   -
 Running Windows-based av to kill active malware is like striking
 a match to see if what you are standing in is water or petrol.
>-------------------- ----- ---- --- -- - -  -   -
Nancy - 14 Mar 2004 14:02 GMT
>-----Original Message-----
>I need to write a batch files that checks what version of
[quoted text clipped - 7 lines]
>.
>REPLY: If you go into my computer and then into Control
look for the systems Icon and click on the tabs you will
find some of the information your looking for,
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.