I have a variable define as:
set filePath=".\file.txt"
I'm writing a windows batch file. Need to convert the path stored in variable 'filePath' to its fullpath (physical path).
How can I get the full path of this path? Please help!
I have a variable define as:
set filePath=".\file.txt"
I'm writing a windows batch file. Need to convert the path stored in variable 'filePath' to its fullpath (physical path).
How can I get the full path of this path? Please help!
Since your question is tagged "command-line" I assume you want to do this in a Windows bat script. There you can expand a variable to the full path using the following syntax:
%~fI
where I is the name of the variable.
The following script will print you the full path to ".\file.txt":
set filePath=".\file.txt"
for %%F in (%filePath%) do set filePath=%%~fF
echo %filePath%
A full reference of available substitutions is contained in the description of the for
command (http://technet.microsoft.com/en-us/library/bb490909.aspx).