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.
>-------------------- ----- ---- --- -- - - - -
>-----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,