Windows XP %RANDOM% cmd.exe variable usage

Joined
Jun 9, 2005
Messages
2
Reaction score
0
I am trying to grab a random number within a specific range for a batch job I've been toying with. I don't know too much about using cmd.exe as a command shell in Windows 2000 Pro, so I'm probably missing an obvious and easy solution. So far the best structure I could come up with would be something like:

SET rnd=
FOR /L %variable IN (range) DO IF %RANDOM%==%variable SET rnd=%variable

which is obviously wrong. I could use help with the syntax but even moreso with the logic. Also, third-party tools are out o' the question; cmd.exe commands only. Thanks for any feedback.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top