Inside the cmd script, you can get the file name and full path, it depends on what will be placed between it possible to get a file name, and full path, it depends of what will be placed between “% ~ ” and ‘0’
Available options:
d — drive
p — path
n — file name
x — extension
f — full path
For example, inside c:\tmp\spell.bat, %~nx0 gives “spell.bat”, and %~dpnx0 gives “c:\tmp\spell.bat”. Note, that all parts are in canonical order, so even %~xnpd0, gives “c:\tmp\my_spell.bat”
Origin from StackOverflow.com