How to? issue with % and evaluation

Oct 18, 2008
Hello -- I am having and issue with the tool/program exiftool

it seems that some of the command line switches will use % as part of tag to indicate a replacement value, ie %f will replace %f with the filename, so a command line might look like

exiftool -w %f .....

I have exiftool set up as batfile to get to the location where its located, then that bat file runs exiftool.exe

my issue is when at the cmd prompt I issue

exiftool -w %f .....

The first level of evaluation removes %f (%f does not have any value)

so I then tried

exiftool -w %%f .....

Which sort of worked —

in the exiftool batfile, %1$ — did have ...... %f ... in it (one of % was removed ), but
when later in the batfile I ran

exiftool.exe .....

the “%f” was removed and what was left was

exiftool -w

is there a way to “escape” the “%f” at the command prompt, so when the exiftool (.exe) run is
sees ..... -w %f

Oct 18, 2008
well sort of --- as noted if I specify at the cmd prompt that runs the batfile

exiftoot .... -w %%f .....

then in the bat file %1$ will have the correct string in it, ie

-w %f

but then if in the bat file I have

setdos /x-3
exiftool.exe %1$
setdos /x+3

%1$ will not get evaluated --- that is the issue using setdos

Charles Dye

Super Moderator
Staff member
May 20, 2008
Albuquerque, NM
I'd be tempted to substitute some other character for the percent sign. Say, ~f instead of %f. Then, in the batch file, replace it only when actually passing it on to the external: exiftool.exe %@replace[~,%%%%,%args]
Oct 18, 2008
yes -- that would be the best solution ... as it turns out exiftool does not have a way to change % to something else and since with cmd.exe, %%f on the cmd prompt would do the "right thing" @replace would make sense with tcc
Thread starter Similar threads Forum Replies Date
Jay Sage Support 37
Jay Sage Support 3
S Support 0
Jay Sage Support 0
samintz Support 3