I have to modify a batch file (written by a former employee) that uses a for %%f in (%*) do ( ... ) loop to operate on each command-line parameter. The new requirement is that a directory name will be appended to the batch call, and this directory is to be used for each parameter with a relative path. For example:
DoJob.bat Fin.txt "D:\Ref Quotes\*.pdf" ..\*.doc "E:\Jan 2012"
should translate to:
DoJob.bat "E:\Jan 2012\Fin.txt" "D:\Ref Quotes\*.pdf" "E:\Jan 2012\..\*.doc"
Once I have the final command-line parameter in a variable, I can prefix it to each parameter that doesn't contain a colon (and thus is a relative path). But my problem is, how do I go about obtaining this final command-line parameter, and how do I make the loop above stop processing at the penultimate parameter?
(Please do not suggest alternatives to batch files; I have already enquired and the only available option is to modify the existing one.)