The command runs fine used directly through the command prompt. When I run it through the bat file it shows this error: MIssingArgument '-format' at CLI arg 3 @fatal/magick-cli.c/ProcessCommandOptions/444
The main goal is to write the pixel counts of black and white to the txt file.
Thanks for any help that can be given.
Here is my bat I am running.
---------------------------
REM ask user for Filename
set /p filename= Enter File Name:
echo The File name is - %filename%.
pause
REM Create Folder
md C:\Users\Public\Pictures\%filename%
ren C:\Users\Public\Pictures\img.bmp %filename%.bmp
move /-Y C:\Users\Public\Pictures\%filename%.bmp C:\Users\Public\Pictures\%filename%\%filename%.bmp
echo Folder created..
echo Processing Image...
REM process Image and place in new folder
magick.exe C:\Users\Public\Pictures\%filename%\%filename%.bmp -monochrome -format %c histogram:info:C:\Users\Public\Pictures\%filename%\%filename%.txt
pause
------------------------
Error when running windows bat file.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Error when running windows bat file.
I am not a Windows user, but I believe all % need to be doubled as %% in .bat files. See http://www.imagemagick.org/Usage/windows/ or Windows syntax issues.
- GeeMack
- Posts: 718
- Joined: 2015-12-01T22:09:46-07:00
- Authentication code: 1151
- Location: Central Illinois, USA
Re: Error when running windows bat file.
As fmw42 mentioned, the percent signs "%"in a BAT script — other than the ones at each end of the SET variables — need to be doubled "%%".cerdmier wrote: ↑2017-02-16T13:47:03-07:00 The command runs fine used directly through the command prompt. When I run it through the bat file it shows this error: MIssingArgument '-format' at CLI arg 3 @fatal/magick-cli.c/ProcessCommandOptions/444
magick.exe C:\Users\Public\Pictures\%filename%\%filename%.bmp -monochrome -format %c histogram:info:C:\Users\Public\Pictures\%filename%\%filename%.txt
Re: Error when running windows bat file.
That got it! The %c switch for format needed to be %%c. Everything else using the filename variable was working as it should. Thanks for your help.