I have a .bat file. I want to programmatically get the name of the .bat file. How can I do this?
This is my end goal
"..\lib\nant\nant.exe" -buildfile:nant.build {{pass in name of this file here}}
pause
I have a .bat file. I want to programmatically get the name of the .bat file. How can I do this?
This is my end goal
"..\lib\nant\nant.exe" -buildfile:nant.build {{pass in name of this file here}}
pause
Try
for /?
on the command line. The help shows all kinds of useful filename substitutions, such as:Replace I with 0 to get just the batch file name, and replace I with 1, 2, 3, etc. to get argument names.
The %0% variable will give you the fully qualified path to the batch file, including its name. There may be a better way to get just the name.