Batch command for ImageMagick to convert all files in a directory and sub-directories on windows

Try with a FOR loop with /R flag from inside your root folder:

FOR /R %a IN (*.svg) DO convert "%~a" "%~dpna.jpg"

this command will convert all the .svg files in your sub-directories under the root folder you launched your command from.

Above command works for command line, if you plan to use the command inside a batch file (.bat) remember to use %% instead of %:

FOR /R %%a IN (*.svg) DO convert "%%~a" "%%~dpna.jpg"

See this page of Imagemagick documentation for more info

Leave a Comment