By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

How to? issue with % and evaluation

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

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
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]
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
I assume that CMD does the "right thing" because %f is not expanded whereas %f% is.

Similar threads