Starting random batch file from a certain folder

后端 未结 2 1441
南旧
南旧 2021-01-29 11:41

Problem is this, I have one folder named \"abc\" with several batch files and they are named like this:

abc1.bat
abc2.bat
abc3.bat
abc4

2条回答
  •  误落风尘
    2021-01-29 12:05

    Say 1000 is the number of your abcX.bat files. Then this will do the trick:

    SET /a rand=%RANDOM%*1000/32768+1
    CALL abc%rand%.bat
    

提交回复
热议问题