The following mostly works. ‘Mostly’, because the use of the SOMETHING..\tasks\ pathname confuses Spring when a context XML file tries to include another by relative pathname. So, what I seem to need is a way, in a BAT file, of setting a variable to the parent directory of a pathname.
set ROOT=%~dp0
java -Xmx1g -jar %ROOT%\..\lib\ajar.jar %ROOT%\..\tasks\fas-model.xml tasks
To resolve a relative path name you can utilize a sub routine call.
At the end of your batch file place the following lines:
This is a sub routine that resolves its first parameter to a full path (
%~f1) and stores the result to the (global) variable named by the 2nd parameterYou can use the routine like this:
After the call you can use the variable
%PARENT_ROOT%that contains the parent path name contained in the%ROOT%variable.Your complete batch file should look like this: