Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

How to manipulate variables in batch loop

$
0
0
Hey everyone,
I am having some issues on how to manipulate variables in a for loop that I am sending to a jar file... any suggestions would be appreciated. The code runs, but the math doesnt..

@echo off

echo Welcome, this will run Lab1.jar
:: Set the amount of times to run from user input
set /P numToRun= Please enter how many times to run the program: 

set /a numParam = 1000
set /a strParam = 1000

:: Start looping here while increasing the jar pars
:: Loop from 0 to numToRun
for /L %%i in (1 1 %numToRun%) do (
	set /a numParam = %numParam% * 10 
	set /a strParam = %strParam% * 10 
	java -jar Lab1.jar %numParam% %strParam%
	
	:: The two lines below are used for testing
	echo %numParam%  
	echo %strParam%
)

@echo on



whenever I output those two parameters, they just output the original value of 1000

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>