gpt4 book ai didi

batch-file - 批处理无效编号错误?

转载 作者:行者123 更新时间:2023-12-04 16:45:13 30 4
gpt4 key购买 nike

这是我遇到过的最奇怪的错误。虽然我已经看到了:

Invalid number.  Numeric constants are either decimal (17),
hexadecimal (0x11), or octal (021).

错误一百万次,我不明白这段代码有什么问题:

if "%ss%" == "00" (
set /a 3n%1+=%3
set /a 3n%1+=%4
)

这给出:

C:\Users\...>if "00" == "00" (
set /a 3n2+=1
set /a 3n2+=3
)
Invalid number. Numeric constants are either decimal (17),
hexadecimal (0x11), or octal (021).

我不明白为什么会发生这种情况。

注意:即使表达式为 false,错误仍然会触发。

最佳答案

该错误是由于您的变量名称 3n2 以数字开头的事实造成的。

虽然变量名称在技术上是有效的,starting it with a number is a really bad idea and you should never do it .

为避免错误,请将变量名称的第一个字符更改为字母或下划线。

if "%ss%" == "00" (
set /a _3n%1+=%3
set /a _3n%1+=%4
)

关于batch-file - 批处理无效编号错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32301759/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com