fir3net
PPS-Firenetbanner-780.5x190-30-03-17

Windows - Environment Variables Windows 2000/XP

Environment variables are a set of dynamic named values that can affect the way running processes will behave on a computer.

%ALLUSERSPROFILE% Returns the location of the All Users Profile
%APPDATA% Returns the location where applications store data by default.
%CD% Returns the current directory string
%CMDCMDLINE% Returns the exact command line used to start the current cmd.exe
%CMDEXTVERSION% Returns the version number of the current Command Processor Extensions
%COMPUTERNAME% Returns the name of the computer
%COMSPEC% Returns the exact path to the command shell executable
%DATE% Returns the current date.
%ERRORLEVEL% Returns the error code of the most recently used command
%HOMEDRIVE% Returns which local workstation drive letter is connected to the user's home directory
%HOMEPATH% Returns the full path of the user's home directory
%HOMESHARE% Returns the network path to the user's shared home directory
%LOGONSERVER% Returns the name of the domain controller that validated the current logon session
%NUMBER_OF_PROCESSORS% Returns the number of processors installed on the computer
%OS% Returns the OS name.
%PATH% Returns the search path for executable files
%PATHEXT% Returns a list of the file extensions that the OS considers to be executable
%PROCESSOR_ARCHITECTURE% Returns the processor's chip architecture
%PROCESSOR_IDENTIFIER% Returns a description of the processor
%PROCESSOR_LEVEL% Returns the model number of the computer's processor
%PROCESSOR_REVISION% Returns the revision number of the processor
%PROGRAMFILES% Returns the location of the default install directory for applications
%PROMPT% Returns the command-prompt settings for the current interpreter
%RANDOM% Returns a random decimal number between 0 and 32767
%SYSTEMDRIVE% Returns the drive containing the Windows root directory 
%SYSTEMROOT% Returns the location of the Windows root directory
%TEMP% Return the default tem dir for apps that are available to users who are currently logged on
%TMP% Return the default tem dir for apps that are available to users who are currently logged on
%TIME% Returns the current time
%USERDOMAIN% Returns the name of the domain that contains the user's account
%USERNAME% Returns the name of the user currently logged on
%USERPROFILE% Returns the location of the profile for the current user
%WINDIR% Returns the location of the OS directory

You can use these in either batch files or enter these straight into the Command Prompt.

C:\Documents and Settings\administrator> echo %DATE%
26/07/2009

About the Author

RDonato

R Donato

Rick Donato is the Founder and Chief Editor of Fir3net.com. He currently works as a Principal Network Security Engineer and has a keen interest in automation and the cloud.

You can find Rick on Twitter @f3lix001