%0 refer argument 0 - the name of the batch file - always exactly the same as specified on the command line or in another batch file.
So, if a batch file with the name Test.batstored in C:\Tempis launched, for example, from a command window with the current directory C:\c temp\test, then the link %0is replaced with temp\teston.
%~f0 - , 1 , &()[]{}^=;!'+,`~ .
Test.bat C:\Temp
@echo %0
@echo %~f0
"temp\test.bat" C:\:
"temp\test.bat"
C:\Temp\Test.bat
:
%~f0 CALL call /? FOR for /? .
1:
, , CD PUSHD. . ~ dp0 .
2:
C:\ "temp\test" :
"temp\test"
C:\Temp\Test
, , . temp\test :
temp\test
C:\Temp\Test.bat