When you issue the name of a procedure that is located elsewhere than
in the currently active folder, but rely on the PATH to provide the
correct location, that formulation will always return the local folder
- unless the full pathspec was provided in calling the procedure.
(whew - I'm out of breath - that was a long one. ;-). The work around
is to search the path for the correct location, something like
this ...
for %%P in (. %path%) do if exist "%%P\%~nx0" set "BatPathspec=%%~fP\
%~nx0"
Unfortunately, in the age Windows, the "Program Files" and "Program
Files (86)" screw this approach up, because of the embeded spaces.
The real culprit is the closing paren. Unless you put something in a
"Program Files" location, you might get away with replacing the
closing paren with something else, like ...
@echo off
for %%P in (. %path:)=^)%) do if exist "%%P\%~nx0" set "BatPathspec=%
%~fP\%~nx0"
set batpathspec
____________________________
Tom Lavedas