To expand on DosItHelp . . .
call /? will show you what the parameters are that you can use.
%1, %2 you're probably familiar with as the 1st, 2nd parameter that you can pass to a script file. Well, %0 is the actual command that you call.
From the help screen: %~fN (where N is the parameter on the command line you're interested in) "expands %N to a fully qualified path name". This is actually the full path and file name -- regardless of how the file was actually called. Example:
If I'm in the c:\tmp directory and I execute the following command:
Code: Select all
test.cmd c:\windows\file.txt .\file.txt ..\file.txt "c:\program files\file.txt" "a file.txt"
Then the following will be defined:
%~f0 evaluates to c:\tmp\test.cmd
%~f1 evaluates to c:\windows\file.txt
%~f2 evaluates to c:\tmp\file.txt
%~f3 evaluates to c:\file.txt
%~f4 evaluates to c:\program files\file.txt NOTE THERE ARE NO QUOTES
%~f5 evaluates to c:\tmp\a file.txt (still NO QUOTES)
The files don't actually have to exist.