Created
June 18, 2023 17:49
-
-
Save Kagee/bf2a226dd93ce9f606c6e7832fe188e3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
rem https://stackoverflow.com/a/5370380 | |
rem Loop on multiple input files and auto | |
rem trim them using magick "!item_%%n!" -trim "!item_%%n!" | |
setlocal ENABLEDELAYEDEXPANSION | |
rem Take the cmd-line, remove all until the first parameter | |
set "params=!cmdcmdline:~0,-1!" | |
set "params=!params:*" =!" | |
set count=0 | |
rem Split the parameters on spaces but respect the quotes | |
for %%G IN (!params!) do ( | |
set /a count+=1 | |
set "item_!count!=%%~G" | |
rem echo !count! %%~G | |
) | |
rem list the parameters | |
for /L %%n in (1,1,!count!) DO ( | |
rem echo %%n #!item_%%n!# | |
magick "!item_%%n!" -trim "!item_%%n!" | |
) | |
rem pause | |
REM ** The exit is important, so the cmd.ex doesn't try to execute commands after ampersands | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment