我有这段代码,它按预期运行并完成。但是会给出错误后的错误。
Missing operator.
'-3' is not recognized as an internal or external command,
operable program or batch file.
Missing operator.
'-3' is not recognized as an internal or external command,
operable program or batch file.
r.6.5.mca
它确实回应了正确答案,尽管r.6.5.mca
这是代码
SET /a minrand=-3
SET /a maxrand=3
set /a placeobject=0
set /a createname=0
set /a oldX=5
set /a oldY=2
SET /a shiftX=%RANDOM% %% (maxrand-minrand+1)+minrand rem will set shiftX to number between %maxrand% & %minrand%
SET /a shiftY=%RANDOM% %% (maxrand-minrand+1)+minrand rem will set shiftY to number between %maxrand% & %minrand%
SET /a newX= (oldX+shiftX)
SET /a newY= (oldY+shiftY)
echo r.%newX%.%newY%.mca
pause
我注意到的一件事是,如果minrand是正数,问题就不会发生。对于这个程序,虽然它必须是负数。请记住它有效,但会引发错误。
答案 0 :(得分:1)
你不能在这样的行中使用rem
。将它们移到一个单独的线上,你所有的麻烦都消失了。