Quick References
      ADO
      ASP
      CSS2
      HTML
      JavaScript
      Jet SQL
      VBScript
      WML
      WMLScript
      WSH
      XHTML
      XML DOM
      XSLT

Features
      Knowledge Base
      Tutorials

Partners
     ZVON.ORG
     XML
     Planet Source Code
     VisualBuilder
     Web Design
     Your HTML Source
     XML/XSLT Forums
     ASPAlliance
     Scripts
     
     Programmers Heaven
     Tek-Tips Forums
     Developer Fusion
     Code Project











Property:  WshShell.Environment

WshShell.Environment([strType])

The Environment property returns the WshEnvironment object. The optional parameter strType can be either "System", "User", "Volatile", or "Process". If strType is omitted, this property retrieves the "System" environment variables in Microsoft Windows 2000 or the "Process" environment variables in Windows 95/98.

The following table lists some of the variables that are provided with the Windows operating system. None of these variables are available from the "Volatile" environment type.

Name Description Windows 2000 Windows 95/98
System User Process Process
NUMBER_OF_PROCESSORS Number of processors running on the machine. X   X  
PROCESSOR_ARCHITECTURE Processor type of the user's workstation. X   X  
PROCESSOR_IDENTIFIER Processor ID of the user's workstation. X   X  
PROCESSOR_LEVEL Processor level of the user's workstation. X   X  
PROCESSOR_VERSION Processor version of the user's workstation. X   X  
OS Operating system on the user's workstation. X   X  
COMSPEC Executable file for the command prompt (typically cmd.exe). X   X X
HOMEDRIVE Primary local drive (typically the C drive).     X  
HOMEPATH Default directory for users (Typically \users\default in Windows 2000).     X  
PATH PATH environment variable. X X X X
PATHEXT Extensions for executable files (typically .com, .exe, .bat, or .cmd). X   X  
PROMPT Command prompt (typically $P$G).     X X
SYSTEMDRIVE Local drive on which the system directory resides (typically c:\).     X  
SYSTEMROOT System directory (for example, c:\winnt). This is the same as WINDIR.     X  
WINDIR System directory (for example, c:\winnt). This is the same as SYSTEMROOT. X   X X
TEMP Directory for storing temporary files (for example, c:\temp).   X X X
TMP Directory for storing temporary files (for example, c:\temp).   X X X


The following VBScript code retrieves the operating system on the current system and echoes the result to the user.

Code:
Set WshShell = WScript.CreateObject("WScript.Shell")
Set objEnv = WshShell.Environment("System")
WScript.Echo objEnv("OS")


Output:
WINDOWS_NT

 


Copyright 1999-2005 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information