I need to randomly generate a number of values in a batch file that share a certain range and concatenate them together separated by spaces. Everything works except for concatenating the space-separated numbers together. The specific problematic issue is concatenating with the numbers with spaces, how do I go about this?
The relevent portion follows:
::Assume %minA%, %maxA% and %randB% are defined correctly.
set /a randA=(%random% %% %maxA%) + %minA%
set agent_counter=0
:start_agent_loop
if %agent_counter% equ %randA% goto end
set /a randApos=(%random% %% %randB%) + 1
::supposedly (if I recall), simply having a space between %agent_starts%
::and %randApos% should do the trick, this doesn't seem to be the case.
set agent_starts = %agent_starts% %randApos%
set /a agent_counter +=1
goto start_agent_loop
:end
echo -A %agent_starts%
Ideally, this should print something like...
C:\Path\>genparams.bat
-A 2 4 5
Currently I get
-A