Reputation: 3
Need help here, I'm trying to make my batch file print a random number, and then repeat that random number multiple times, here's what I want.
echo Your ID is: %RANDOM%
echo Again, your ID is: %RANDOM%
Is there anyway to have the two randoms match each other and print the same number? But be different everytime I open the .bat?
Upvotes: 0
Views: 108
Reputation: 36
set random2=%RANDOM%
echo Your ID is: %random2%
echo Again, Your ID is: %random2%
basically, set random2=%RANDOM%
sets a variable named "random2" to said random number. then, echo Your ID is: %random2%
will print correctly, along with the second echo
.
let's say the random number is 10082
. the code states it as:
Your ID is: 10082
Again, Your ID is: 10082
Upvotes: 1