
Originally Posted by
SvenBent
just need to understand the method because if it does what i think it does you just helped me with alot of other batch scripts
the for line call batch2 with
%1= being path with no file name
%2 = File name
right ?
Pushd %1 = go to the path %1 but remember current path
precomp -r %2 = run precomp /r in file
Popd = go back the "current dir" before Pushd jumped away
my other batches i needed to save %cd% into a variable and later do "CD %variable%"
this is just so much easier
I'm glad I could help you
Yes, that's exactly how it works. PUSHD, POPD and the enhanced FOR syntax (%%~dpf %%~nxf) are features that are available for Windows 2000 and above. You can call the help for FOR using "for /?", there is much text, but this is the most interesting part of it for this script:
Code:
In addition, substitution of FOR variable references has been enhanced.
You can now use the following optional syntax:
[...]
%~dI - expands %I to a drive letter only
%~pI - expands %I to a path only
%~nI - expands %I to a file name only
%~xI - expands %I to a file extension only
[...]
The modifiers can be combined to get compound results:
%~dpI - expands %I to a drive letter and path only
%~nxI - expands %I to a file name and extension only