Getting the full path of a batch file

I would like to create a batch file that uses (e.g. prints) the full path:

c:\tmp\foo> nice.bat

I am c:\tmp\foo\nice.bat
+3
source share
4 answers

You can use% ~ f0 (for example, "echo% ~ f0").

+6
source

% ~ dp0 from memory is the full path to the batch file.

EDIT . For easier replacement startcall /?

+3
source

try the following:

 echo I am %~f0
+2
source

Source: https://habr.com/ru/post/1717638/


All Articles