从某个文件夹开始随机批处理文件 [英] Starting random batch file from a certain folder

查看:113
本文介绍了从某个文件夹开始随机批处理文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题是这样的,我有一个文件夹命名为ABC与几个批处理文件和它们被命名为这样的:

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.bat

abc1.bat
abc2.bat
abc3.bat
abc4.bat

等等...

我需要一个脚本,将随机启动这些批处理文件之一,当我点击它。脚本我需要将存储在名为abcRandom.bat或类似的同一文件夹中。

I need a script that will randomly start one of those batch files when I click it. Script I need will be stored in the same folder by the name "abcRandom.bat" or something similar.

推荐答案

1000说你abcX.bat文件的数量。那么这将这样的伎俩:

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

这篇关于从某个文件夹开始随机批处理文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆