有没有一种方法可以做到这一点,而不是每次都设置相同的回显,您可以给出一个回显列表,并且每次到达该回显命令时它都会选择一个随机的回显?
是的。这是一个概念证明。
@echo off
setlocal enabledelayedexpansion
set string[0]=This is the first random line.
set string[1]=This is the second random line.
set string[2]=This is the third random line.
set /a idx=%random% * 3 / 32768
echo !string[%idx%]!
这里有更多信息生成随机数 https://stackoverflow.com/a/5777608/1683264在 Windows 批处理脚本中。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)