简体   繁体   中英

Run 30 jar from batch and save the output result for each jar

Hi i have a question about running several jar files in the same folder by batch file. I need to create a loop and read all the jar files name, and run them all, and create output for all jars. like this code:

cls
cd\ 
cd C:\java\
set PATH=%PATH%;C:\Program Files\Java\jdk1.8.0_20\bin;
cls

javac -jar "here come the name from the folder"

jarname < input1+"the name of the jar".txt > output1+"the name of the jar".txt 

How about something like:

for %%j in (*.jar) do (
java -jar "%%j" < "input%%~nj.txt" > "output%%~nj.txt"
)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM