Random number in your batch files?

posted by Knut Torgersen
Nov 24

If you need a random number no larger than 32767, you can use the reserved environment variable %random% to generate one. Try this in a command window:

echo %random%

This should return a value between 0 and 32767. If you need larger, create another random number and multiply them. If you need less, figure out a formula. It is actually quite easy…

Categories: Scripting ,Windows


Leave a Reply

You must be logged in to post a comment.