----^--->
/\

//\\
//The\
/Sy
stem\
////
Guard
\

In the mount of the LORD it shall be seen. Genesis 22:14

GetOS

Booming Or Fuming? | MasterCatalog | ntlib (FREE) | NTCmdLib | MtCmds | Scripts | Almost Free | TheGuardBook | Help

 

Types of
.Mount/\Commands

.CrystalClear | .ExactName | .ExitELn | .GetValue | .ifCondition | .ifELn | .IsPattern | .ListValue | .NetValue | .NowValue | .RedirRapids | .ReliableReporting | .RestoreValue | .SetELn | .ValueEcho

.GetValue
Series

  .GetCD | .GetDate | GetDirSize | GetDirSizeM | GetFree | GetFreeM | GetIPAddr | GetIPGateway | GetIPMask | GetLogDate | GetLogTime | GetLogTimeP | GetMac | GetNic | GetOS | GetRole | GetTempFile | GetTime | GetTimeP

.GetOS

Description

  1. Displays the current Operating System
  2. Saves the value in #os
  3. Sets errorlevel based on the result

Syntax

%.GetOS%    

Parameters and Switches

none

   

Errorlevels and Output Variables

Console
Display

 

Value of
#os

 

Error
Level

  Description of Result
NT   NT  

0

  Windows NT found
2K   2K  

1

  Windows 2000 found
XP   XP  

2

  Windows XP found
K3   K3  

3

  Windows Server 2003 found
Unknown   Unknown  

123

  OS not recognized (None of the above)

Examples, Notes and Instructions

NT C:\GuardPost>%.GetOS%
NT
C:\GuardPost>ECHO:%Errorlevel%
0
C:\GuardPost>SET #os
#os=NT
2K C:\GuardPost>%.GetOS%
2K
C:\GuardPost>ECHO:%Errorlevel%
1
C:\GuardPost>SET #os
#os=2K
XP C:\GuardPost>%.GetOS%
XP
C:\GuardPost>ECHO:%Errorlevel%
2
C:\GuardPost>SET #os
#os=XP
K3 C:\GuardPost>%.GetOS%
K3
C:\GuardPost>ECHO:%Errorlevel%
3
C:\GuardPost>SET #os
#os=K3

  • Output is displayed to STDOUT
  • To suppress console display, use

    %.GetOS% %.Quiet%

    {errorlevel and output variable(s) will still be available}


Related .Mount/\Commands, #Constants, $Functions, :Procedures

Resource

  Short Description
.ifNT   TRUE if the OS is Windows NT.  Otherwise FALSE.
.ifNotNT   TRUE if the OS is NOT Windows NT.  Otherwise FALSE.
.ifXP   TRUE if the OS is Windows XP.  Otherwise FALSE.
.ifNotXP   TRUE if the OS is NOT Windows XP.  Otherwise FALSE.
.if2K   TRUE if the OS is Windows 2000.  Otherwise FALSE.
.ifNot2K   TRUE if the OS is NOT Windows 2000.  Otherwise FALSE.
.ifK3   TRUE if the OS is Windows Server 2003.  Otherwise FALSE.
.ifNotK3   TRUE if the OS is NOT Windows Server 2003.  Otherwise FALSE.
#os   Operating System Code (NT, 2K, XP or K3)

K

E

Y

Common Commands INTERNAL External /SWITCH Parameter Help text AddonTool
Mounted Commands .Mount/\Command CmdShorthand #Constant $FUNCTION :Procedure !GuardNote
Operating Systems NT/2K/XP/K3 NT Only NT/2K 2K Only 2K/XP XP Only XP/K3 K3 Only 2K/XP/K3

.GetValue
Series

  .GetCD | .GetDate | GetDirSize | GetDirSizeM | GetFree | GetFreeM | GetIPAddr | GetIPGateway | GetIPMask | GetLogDate | GetLogTime | GetLogTimeP | GetMac | GetNic | GetOS | GetRole | GetTempFile | GetTime | GetTimeP
/\
//\\
//
The\
/Sy
stem\
////
Guard
\
COME ON UP WITH US!
and
Congratulations On Your Decision
to
RISE ABOVE
THE REST!

^
/
!\
/LIB\

TheSystemGuard.com [Revised: 2007-03-29]
Copyright © 1995-2007, JWC
Computer Communications,
All Rights Reserved, Worldwide.
 Disclaimer       Privacy       About Us       More


Communication Is Business!

We Master It With Knowledge!

^
/
.\
/M^C\