Id like to make a batch file that runs a jar X amount of times from user input. I have looked for how to handle user input, but I am not totally sure.
In this loop I’d like to increase the parameters I am sending to the jar.
As of now, I do not know
- manipulate the variables in the for loop, numParam, strParam
So, when i run this little bat file from the command line, I get am able to do user input, but once it gets to the for loop, it spits out “The syntax of the command is incorrect
So far I have the following
@echo off
echo Welcome, this will run Lab1.jar
echo Please enter how many times to run the program
:: Set the amount of times to run from user input
set /P numToRun = prompt
set numParam = 10000
set strParam = 10000
:: Start looping here while increasing the jar pars
:: Loop from 0 to numToRun
for /L %%i in (1 1 %numToRun%) do (
java -jar Lab1.jar %numParam% %strParam%
)
pause
@echo on
Any suggestion would be helpful
Edit:
With the recent change, it doesnt seem to run my jar file. or at least doesnt seem to run my test echo program. It seems that my user input variable is not being set to what I have inputted, it stays at 0
What happened was for my last issues was something with how the variables expanded. This was actually answer at dreamincode.net: Here
Final code: