Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Understanding Variables 17 Understanding Variables Multiple variables are available from the command line. Variables always start and end with a percent symbol (%), and you can easily see the value of any variable by using the echo command. For example, if you want to see the path to the Program Files folder, you can use this command: echo %programfiles% Some of the commonly referenced variables are listed and described in the following table. Variable %programfiles% %systemroot% %windir% %systemdrive% %appdata% %userdomain% %logonserver% Description Shows the path to the Program Files folder (typically C:\Program Files). Shows the path to the Windows folder (typically C:\Windows). Returns the drive of the root directory (typically C:\). Returns the location where applications store data by default. Gives the name of the domain that contains the currently logged on user's account. Lists the name of the domain controller that validated the current logon session (when the system is joined to a domain). Returns the architecture of the processor (such as x86 for 32-bit or AMD64 for 64-bit proces- sors). Lists the location of the profile for the current user. Lists the location of the All Users profile. Lists the current directory string. Returns the current date. Returns the current time. Gives the error number of the last executed command. Anything other than 0 indicates an error occurred. %processor_architecture% %userprofile% %allusersprofile% %cd% %date% %time% %errorlevel% TIP: You can view a listing of all variables by typing the set command. It's also possible to create your own variables if desired. This can sometimes be useful within scripts.