Mr. Tweak - Windows Network & Admin Tweaks

Windows network, systems, and software Administration Tips & Tricks


4 comments Windows Environment Variables List: Paths to System Folders, User Folders, and Useful Values

From a command window, DOS script, or any other shell code the Windows environment variables in the list below can be referenced by adding a “%” before and after the variable name. All of these values are returned as strings. The values can be piped (the “>” command in a “DOS window”) to text files or used in other scripting languages. Also, here are detailed descriptions of some of the more common environment variables.

For example, to find the user profile folder and write it to a textfile:

  1. Open a command console (”cmd” at the Run… prompt).
  2. Type “echo %userprofile% > C:\file.txt” and press Enter. The path to that resource will be printed to screen. (Without the “> C:\file.txt” the value is printed to a line in the command window)
  3. Open the C:\file.txt file and the path to the currently logged on user’s profile will be listed.

Semi-complete* Windows Environment Variable List

  • ALLUSERSPROFILE
  • APPDATA
  • CD
  • CLIENTNAME
  • CLUSTERLOG (probably only on Windows Server clusters)
  • CMDCMDLINE
  • CMDEXTVERSION
  • COMMONPROGRAMFILES
  • COMPUTERNAME
  • COMSPEC
  • DATE
  • ERRORLEVEL
  • FP_NO_HOST_CHECK (only with FrontPage installed?)
  • HOMEDRIVE
  • HOMEPATH
  • HOMESHARE
  • LOGONSEVER
  • NUMBER_OF_PROCESSORS
  • OS
  • PATH
  • PATHEXT
  • PROCESSOR_ARCHITECTURE
  • PROCESSOR_IDENTFIER
  • PROCESSOR_LEVEL
  • PROCESSOR_REVISION
  • PROGRAMFILES
  • PROMPT
  • RANDOM
  • SYSTEMDRIVE
  • SYSTEMROOT
  • TEMP or TMP
  • TIME
  • USERDOMAIN
  • USERNAME
  • USERPROFILE
  • WINDIR

* These are all I could remember or dig up from the one book I looked in. Please add more in the article comments & I’ll add them to the list. Thanks to ByteHead for four recent additions.

Article tagged: , , , , , , , , ,


4 Responses to “Windows Environment Variables List: Paths to System Folders, User Folders, and Useful Values”

  1. Removing Email Addresses & Names From Outlook 2002 & 2003 Auto-Completion Address Field (.NK2 File Editing) by Mr. Tweak - Windows Network & Admin Tweaks, on June 20th, 2005 at 10:01 pm, said:

    […] ith a particular Outlook user account. On Windows XP desktops these files are typically in %userpro […]

  2. Bryan Price, on December 18th, 2005 at 10:33 am, said:

    CLIENTNAME
    ClusterLog
    CommonProgramFiles
    FP_NO_HOST_CHECK (FrontPage I assume)

  3. Mike Buday, on December 20th, 2005 at 3:57 pm, said:

    Thanks for the additions. They’ve been added to the main list.

  4. Recovery Console Reference to Solve Blue Screen at Startup by Mr. Tweak - Windows Network & Admin Tweaks, on September 7th, 2006 at 10:26 pm, said:

    […] The Recovery Console is an incredibly powerful tool at times when a Windows system boots straight into a blue screen (of death) error or viruses/spyware have even made the system unusable in safe mode. Unfortuantely it’s hard to use for several reasons. Firstky, Microsoft doesn’t, to my knowledge, provide complete documentation for the Recovery Console anywhere. Also, the Recovery Console is a command-line-only interface that’s unfamiliar to most Windows users and even many non-Linux IT staff. Finally, the commands available in this environment are fewer and slightly different from those in a typical Windows shell environment. […]

Comment on this post below


You can leave a response, or trackback from your own site.