I have 4 files scan*.jpg
in a directory and split them into 50% wide images with 4 separate commands in the command prompt:
magick convert -crop 50%x100% scan0000.jpg output0000.jpg
magick convert -crop 50%x100% scan0001.jpg output0001.jpg
magick convert -crop 50%x100% scan0002.jpg output0002.jpg
magick convert -crop 50%x100% scan0003.jpg output0003.jpg
The result is as expected:
04/10/2022 18:41 747.709 scan0000.jpg
04/10/2022 18:41 1.382.076 scan0001.jpg
04/10/2022 18:41 1.646.004 scan0002.jpg
04/10/2022 18:41 2.204.373 scan0003.jpg
04/10/2022 21:08 75.856 output0000-0.jpg
04/10/2022 21:08 559.131 output0000-1.jpg
04/10/2022 21:08 566.601 output0001-0.jpg
04/10/2022 21:08 694.210 output0001-1.jpg
04/10/2022 21:09 700.709 output0002-0.jpg
04/10/2022 21:09 797.154 output0002-1.jpg
04/10/2022 21:09 1.069.680 output0003-0.jpg
04/10/2022 21:09 940.720 output0003-1.jpg
But if I put these same 4 commands in a doit.bat
or doit.cmd
and run that, I get 7000+ small files:
04/10/2022 21:10 1.438 output0000-0.jpg
04/10/2022 21:10 1.627 output0000-1.jpg
04/10/2022 21:10 902 output0000-10.jpg
04/10/2022 21:10 289 output0000-100.jpg
04/10/2022 21:10 289 output0000-1000.jpg
04/10/2022 21:10 289 output0000-1001.jpg
[snip]
04/10/2022 21:10 289 output0000-99.jpg
04/10/2022 21:10 1.253 output0000-990.jpg
04/10/2022 21:10 1.535 output0000-991.jpg
04/10/2022 21:10 2.173 output0000-992.jpg
04/10/2022 21:10 507 output0000-993.jpg
04/10/2022 21:10 348 output0000-994.jpg
04/10/2022 21:10 660 output0000-995.jpg
04/10/2022 21:10 289 output0000-996.jpg
04/10/2022 21:10 289 output0000-997.jpg
04/10/2022 21:10 289 output0000-998.jpg
04/10/2022 21:10 289 output0000-999.jpg
04/10/2022 21:10 2.664 output0001-0.jpg
04/10/2022 21:10 1.960 output0001-1.jpg
04/10/2022 21:10 1.718 output0001-10.jpg
04/10/2022 21:10 922 output0001-100.jpg
04/10/2022 21:10 328 output0001-1000.jpg
04/10/2022 21:10 331 output0001-1001.jpg
[snip]
04/10/2022 21:10 289 output0003-997.jpg
04/10/2022 21:10 2.351 output0003-998.jpg
04/10/2022 21:10 3.015 output0003-999.jpg
How come and how can I prevent this? (I have to convert several batches of 50 files.)
This is on Windows 11.
fmw42 and Mark Setchel both commented with what was essentially the answer, so I'm adding it as an answer here:
The % signs need to escaped (doubled) when copying those command lines into the batch file:
magick convert -crop 50%%x100%% scan0000.jpg output0000.jpg
magick convert -crop 50%%x100%% scan0001.jpg output0001.jpg
magick convert -crop 50%%x100%% scan0002.jpg output0002.jpg
magick convert -crop 50%%x100%% scan0003.jpg output0003.jpg