What environment variables to test to check windows version in bat

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to check if my windows is WinNT or Win2000 or WinXP in a batch file.
So, I want to check the content of a specific environment variable.
But, could you tell me what var to use ?
Otherwise tell me what var is present only in WinXP and not in WinNT, that
way I can check the version by checking if the var is void or not.
Thanks.
 
%os%

"bestofcomputer" <[email protected]>
wrote in message
:I want to check if my windows is WinNT or Win2000 or WinXP
in a batch file.
: So, I want to check the content of a specific environment
variable.
: But, could you tell me what var to use ?
: Otherwise tell me what var is present only in WinXP and
not in WinNT, that
: way I can check the version by checking if the var is void
or not.
: Thanks.
:
:
 
bestofcomputer said:
I want to check if my windows is WinNT or Win2000 or WinXP in a batch file.
So, I want to check the content of a specific environment variable.
But, could you tell me what var to use ?
Otherwise tell me what var is present only in WinXP and not in WinNT, that
way I can check the version by checking if the var is void or not.
Thanks.

perhaps you could try the command

VER

VER|find "XP" >nul

for instance, will set ERRORLEVEL to 0 for XP and non-zero otherwise

For NT/2K/XP batch techniques discussion, try alt.msdos.batch.nt

HTH

....Bill
 
Thank folks for your posts.
My comment :
- %OS% is useless because it is the same value for all windows NT + 2000 +
XP !
- winver is not applicable to my case, since it opens a dialog box, and I
want only to check the windows version on the command line !
- the test with errorlevel after a : ver|find "XP" >nul :very good idea,
and much better that env var.
But about that idea, I need more information :
- for checking winXP, the string to check is "XP".
- for checking win2000, the string to check is "2000".
- for checking winNT, what is the string to check ?
- for checking win2003, what is the string to check ?
Thanks.
 
bestofcomputer said:
Thank folks for your posts.
My comment :
- %OS% is useless because it is the same value for all windows NT + 2000 +
XP !
- winver is not applicable to my case, since it opens a dialog box, and I
want only to check the windows version on the command line !
- the test with errorlevel after a : ver|find "XP" >nul :very good idea,
and much better that env var.
But about that idea, I need more information :
- for checking winXP, the string to check is "XP".
- for checking win2000, the string to check is "2000".
- for checking winNT, what is the string to check ?
- for checking win2003, what is the string to check ?
Thanks.


NT shows "Windows NT Version 4.0"

I don't have access to NT3.51 or 2003

Perhaps by exception?

HTH

....Bill
 
bestofcomputer said:
Thank folks for your posts.
My comment :
- %OS% is useless because it is the same value for all windows NT + 2000 +
XP !
- winver is not applicable to my case, since it opens a dialog box, and I
want only to check the windows version on the command line !
- the test with errorlevel after a : ver|find "XP" >nul :very good idea,
and much better that env var.
But about that idea, I need more information :
- for checking winXP, the string to check is "XP".
- for checking win2000, the string to check is "2000".
- for checking winNT, what is the string to check ?
"NT"

- for checking win2003, what is the string to check ?
Thanks.

"2003"

Steve N.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top