• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 4. File and Registry Access > Working with the Environment

Working with the Environment

Environment variables such as the program PATH and the temporary file folder name TEMP can be examined by looking through the Environment property of WScript.Shell. Environment("process") returns a collection of WshEnvironment objects that define the current set of environment variables. You can examine this collection to extract environment variable definitions. Here are some reasons you may want to do this:

  • To find the name of the folder to be used for scratch files, which is named by the TEMP environment variable.

  • To look through the program search path (variable PATH) to see where a program is installed.

  • To look up special settings communicated in the environment, such as the location of library files (variable LIB), the logged-on user's name (variable USERNAME), or the current processor type (PROCESSOR_ARCHITECTURE). Although these settings may be tampered with by the computer's user, they're convenient when security is not at stake.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint