Wednesday, December 8, 2010

Useful CMD/BAT Path Expansion Variables

Save the following code into a .CMD or .BAT file and run it in a CMD shell console.  For some more see http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/percent.mspx?mfr=true  The lines in red are only applicable to 64-bit Windows installations.

@echo off
echo displaying various path alias values...
echo %~nx0
echo %comspec%
echo %~d0
echo %~dp0
echo %~dps0
echo %~dpp0
echo %~f0
echo --------------------------------
echo %systemdrive%
echo %systemroot%
echo %windir%
echo %programdata%
echo %programfiles%
echo %programfiles(x86)%
echo %userprofile%
echo %allusersprofile%
echo %temp%
echo %commonprogramfiles%
echo %commonprogramfiles(x86)%
echo %appdata%
echo %localappdata%
echo %public%

Post a Comment