我在批处理代码中遇到 <、> 和 == 等数字比较的困难。我正在做的是生成一个随机数并使用该答案来做某事,这就是我所写的:
set rand=%random%
set rand=%rand:~1,1%
If %rand%==9 goto nine
If %rand%>5 goto above 5
If %rand%>1 goto above 1
If %rand%==0 goto zero
Run Code Online (Sandbox Code Playgroud)
当我运行代码时,代码就会关闭。我尝试在被比较的两个对象和不等式之间放置空间,但它仍然不起作用。
请记住,这是 Windows 上的批处理代码。