Set a random number up to a value stored

September 4, 2011 at 17:37:37
Specs: Windows 7
Hello all, I'm having some trouble to find a way out of this:

I want to rename a random file in a folder (all files are numbers starting from 1, and I keep changing the quantity of files in this folder), and the code i was using worked fine, but as i change the amount of files, I had to change the code too... so I tried


for /F %%j in ('dir C:\myfolder /A-D-H /B ^| find /C /V "::"') do set Count=%%j
set /a novoBG=%random%%%%Count%.jpg

so I could use the "novoBG" as it was already working.
But I just can't find out how to get a random number up to the value on the var.

Hope anyone can help me. Thanks


See More: Set a random number up to a value stored

Report •

#1
September 5, 2011 at 02:35:15
Try variable random

Regards,

MUs

Happy is ONE who says I am an OttoMAN.


Report •

#2
September 5, 2011 at 04:36:58
But I am already using, it just don't work if I don't put a number in front of it

Report •
Related Solutions


Ask Question