[gs-bugs] [Bug 691440] Windows bat files use relative paths and write to non-temp dir

bugzilla-daemon at ghostscript.com bugzilla-daemon at ghostscript.com
Fri Jul 9 11:52:51 UTC 2010


pipitas at googlemail.com changed:

           What    |Removed                     |Added
                 CC|                            |pipitas at googlemail.com

--- Comment #3 from pipitas at googlemail.com 2010-07-09 11:52:48 UTC ---
My worry with this would also have been the lacking support for older Windows
systems. Personally, I'm using this trick in my batch files since a few years.

To check, if cmd.exe on your version of Window actually supports it, just run
"for /?" and scroll down towards the end. Here is a list of all posible loop
variable (%a, %b, %c,...) or positional parameter (%0, %1, %2,...) replacements
(using "I" for letter or number):

%~I  : expand %I and remove all enclosing quotes (").
%~fI : expand %I to the full file name.
%~dI : show the drive name where %I is located.
%~pI : show the path for %I.
%~nI : show the name of %I without file suffix.
%~xI : show the suffix of %I.
%~sI : show the 'short' path for %I.
%~aI : show the file attributes of %I.
%~tI : show date+time of %I.
%~zI : show filesize of %I.

One can combine these like for example here:

%dpI : show drive letter with path for %I.
%nxI : show 'filename.suffix' for %I.
%fsI : show path with filename of %I, but completely the short version.

If you use these wisely, you can make .bat files work even using relative

Configure bugmail: http://bugs.ghostscript.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

More information about the gs-bugs mailing list