Windows Variables List


Windows Environment Variables:

Microsoft Original Document

 

Variable

Type Description
%ALLUSERSPROFILE% Local Returns the location of the All Users Profile.
%APPDATA% Local Returns the location where applications store data by default.
%CD% Local Returns the current directory string.
%CMDCMDLINE% Local Returns the exact command line used to start the current Cmd.exe.
%CMDEXTVERSION% System Returns the version number of the current Command Processor Extensions.
%COMPUTERNAME% System Returns the name of the computer.
%COMSPEC% System Returns the exact path to the command shell executable.
%DATE% System Returns the current date. Uses the same format as the date /t command. Generated by Cmd.exe. For more information about the date command, see Date
%ERRORLEVEL% System Returns the error code of the most recently used command. A non zero value usually indicates an error.
%HOMEDRIVE% System Returns which local workstation drive letter is connected to the user’s home directory. Set based on the value of the home directory. The user’s home directory is specified in Local Users and Groups.
%HOMEPATH% System Returns the full path of the user’s home directory. Set based on the value of the home directory. The user’s home directory is specified in Local Users and Groups.
%HOMESHARE% System Returns the network path to the user’s shared home directory. Set based on the value of the home directory. The user’s home directory is specified in Local Users and Groups.
%LOGONSEVER% Local Returns the name of the domain controller that validated the current logon session.
%NUMBER_OF_PROCESSORS% System Specifies the number of processors installed on the computer.
%OS% System Returns the operating system name. Windows 2000 displays the operating system as Windows_NT.
%PATH% System Specifies the search path for executable files.
%PATHEXT% System Returns a list of the file extensions that the operating system considers to be executable.
%PROCESSOR_ARCHITECTURE% System Returns the chip architecture of the processor. Values: x86, IA64.
%PROCESSOR_IDENTIFIER% System Returns a description of the processor.
%PROCESSOR_LEVEL% System Returns the model number of the processor installed on the computer.
%PROCESSOR_REVISION% System Returns the revision number of the processor.
%PROMPT% Local Returns the command prompt settings for the current interpreter. Generated by Cmd.exe.
%RANDOM% System Returns a random decimal number between 0 and 32767. Generated by Cmd.exe.
%SYSTEMDRIVE% System Returns the drive containing the Windows XP root directory (that is, the system root).
%SYSTEMROOT% System Returns the location of the Windows XP root directory.
%TEMP% and %TMP% System and User Returns the default temporary directories that are used by applications available to users who are currently logged on. Some applications require TEMP and others require TMP.
%TIME% System Returns the current time. Uses the same format as the time /t command. Generated by Cmd.exe. For more information about the time command, see Time
%USERDOMAIN% Local Returns the name of the domain that contains the user’s account.
%USERNAME% Local Returns the name of the user who is currently logged on.
%USERPROFILE% Local Returns the location of the profile for the current user.
%WINDIR% System Returns the location of the operating system directory.

 

Windows 2008 R2 Group Policy Preference Process Variables:

Microsoft Original Document

%AppDataDir% UserAppDataDir
%BinaryComputerSid% The SID of the computer in hexadecimal format.
%BinaryUserSid% The SID of the current user in hexadecimal format.
%CommonAppdataDir% The "all users" Application Data directory.
%CommonDesktopDir% The "all users" Desktop directory.
%CommonFavoritesDir% The "all users" Explorer Favorites directory.
%CommonProgramsDir% The "all users" Programs directory.
%CommonStartMenuDir% The "all users" Start Menu directory.
%CommonStartUpDir% The "all users" Startup directory.
%ComputerName% The NetBIOS name of the computer.
%CurrentProcessId% The numeric identity of the main client process.
%CurrentThreadId% The numeric identity of the main client thread.
%DateTime% The current time (UTC).
%DateTimeEx% The current time (UTC) with milliseconds.
%DesktopDir% The current user’s desktop directory.
%DomainName% The domain name or workgroup of the computer.
%FavoritesDir% The current user’s Explorer Favorites directory.
%LastError% The last error code encountered during configuration.
%LastErrorText% The last error code text description.
%LdapComputerSid% The SID of the computer in LDAP escaped binary format.
%LdapUserSid% The SID of the current user in LDAP escaped binary format.
%LocalTime% The current local time.
%LocalTimeEx% The current local time with milliseconds.
%LogonDomain% The domain of the current user.
%LogonServer% The domain controller that authenticated the current user.
%LogonUser% The user name of the current user.
%LogonUserSid% The SID of the current user.
%MacAddress% The first detected MAC address on the computer.
%NetPlacesDir% The current user’s My Network Places directory.
%OsVersion% The operating system: Windows Server® 2008 R2, Windows® 7, Windows Server® 2008, Windows Vista®, Windows Server 2003, Windows XP, or Unknown.
%ProgramFilesDir% The Windows Program Files directory.
%ProgramsDir% The current user’s Programs directory.
%RecentDocumentsDir% The current user’s Recent Documents directory.
%ResultCode% The client’s exit code.
%ResultText% The client’s exit code text description.
%ReversedComputerSid% The SID of the computer in reversed byte order hexadecimal format.
%ReversedUserSid% The SID of the current user in reversed byte order hexadecimal format.
%SendToDir% The current user’s Send to directory.
%StartMenuDir% The current user’s Start Menu directory.
%StartUpDir% The current user’s Startup directory.
%SystemDir% The Windows system directory.
%SystemDrive% The name of the drive from which the operating system is running.
%TempDir% The current user’s Temp directory as determined by Windows API.
%TimeStamp% The time stamp of the configurations being implemented.
%TraceFile% The path/name of the trace file.
%WindowsDir% The Windows directory.

  1. No comments yet.
(will not be published)