Run .jar several times with different parameters

I have 2186 jpeg files that I need to convert to another file type with a specific program. Unfortunately, I feel really bad when it comes to batch files, but here's what I still have:

java -jar -Xmx1024m convert.jar -d2 -h64 -w64 -s Untitled_000000.jpeg output_000000.schematic

It requires the Untitled_000000.jpeg file and converts it to output_000000.schematic. How can I get around how to convert 2186 files automatically, to output_002185.schematic?

Thank!

+4
source share
2 answers

Try the following:

Main.bat

@echo off
for /l %%a in (0, 1, 2185) do (Pad.bat "%%a")

And in the same directory:

Pad.bat

set var=%1
:loop
set var=0%var%
if "%var:~5,1%"=="" goto :loop

java -jar -Xmx1024m convert.jar -d2 -h64 -w64 -s Untitled_%var%.jpeg output_%var%.schematic

And it will work for you. (I tested it)

+1
source
@echo off


setlocal enableDelayedExpansion
pushd C:\pics_dir
for /l %%L in (Untitled_*.jpeg) do (
    set "file_name=%%~nL"
    set "current_number=!file_name:~9!"
    java -jar -Xmx1024m c:\convert.jar -d2 -h64 -w64 -s "%%~L" output_!current_number!.schematic
)

endlocal
0
source

Source: https://habr.com/ru/post/1545652/


All Articles