无效号码。数字常量要么是十进制(17),十六进制(0×11),或八进制(021) [英] Invalid number. Numeric constants are either decimal (17), hexadecimal (0x11), or octal (021)

查看:1188
本文介绍了无效号码。数字常量要么是十进制(17),十六进制(0×11),或八进制(021)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想执行批处理文件并调用它本身的10倍。

I wish to execute a batch file and have it call itself 10 times.

set /a iteration=0%1+1
IF %iteration% EQU 10 exit
rem Taskkill /IM aspnet_compiler.exe /F
timeout 1
call KillBILLd.bat %iteration%

然而,将仅与示数之前获取到8号

However, it will only get to the number 8 before erroring with

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

这行

set /a iteration=0%1+1

如何解决这个问题?

How can I fix this error?

推荐答案

您已经有了 0%1 在EX pression - 如果你的论点是8 ,扩展为 08 ,这不是有效的八进制数(8不是一个八进制数字),所以你得到这个错误。我不是一个批处理文件专家,但我猜你要离开了领先的 0

You've got 0%1 in that expression - if your argument is 8, that expands to 08, which isn't a valid octal number (8 is not an octal digit), and so you get that error. I'm not a batch file expert, but I guess you want to leave off the leading 0:

set /a iteration=%1+1

下面是一些 SET命令文档的链接。

这篇关于无效号码。数字常量要么是十进制(17),十六进制(0×11),或八进制(021)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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