Command wont run in bacth file

Started by PSRPixel, February 02, 2023, 04:15:54 AM

Previous topic - Next topic

PSRPixel

Morning All

I am new here and so the app is great and does more than I need it to.

I have my command to do what I want and it works on the command line but not ina batch file. I know it is to do with %. But I have tried and cant figure it. I am hoping someone here is better than me and can help me. My bat file text is below:-

mkdir %date:~-2,2%""%date:~-7,2%""%date:~-10,2%

:start

exiftool -r -d %date:~-2,2%""%date:~-7,2%""%date:~-10,2%/%H/%H%M%S%%-c.%%e "-filename<filemodifydate" "C:\Users\User\Desktop\FTP\A\A\DCIM"

timeout /t 60 /nobreak

goto start

I am sure it is a easy fit but I just cant see it myself.

Thank you in advance.

Phil Harvey

All "%" characters in the ExifTool command must be doubled (to "%%") in a .bat file.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

PSRPixel

Thank you, I have not done that. Also would the %%e be %%%%e or %%%e do you think?

Phil Harvey

...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

StarGeek

#4
Quote from: PSRPixel on February 02, 2023, 04:15:54 AMI have my command to do what I want and it works on the command line but not ina batch file. I know it is to do with %. But I have tried and cant figure it. I am hoping someone here is better than me and can help me.

Make sure you read the FAQ, as this is FAQ #27.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype


PSRPixel

Quote from: StarGeek on February 02, 2023, 10:19:11 AMMake sure you read the FAQj, as this is FAQ #27.

Thank you, yes I should of maybe tried that. Sorry.