Batch file 批处理集/a不工作

Batch file 批处理集/a不工作,batch-file,Batch File,我看了很多,找不到为什么会这样。这很简单,但不起作用 :numbers cls set /p first=First: set /p second=Second: set /p third=Third: set /p fourth=Fourth: set /p fifth=Fifth: goto solve :solve cls set /a s-f= %second% - %first% set /a t-s= %third% - %second% 但最后两行不起作用,我知道这是因为我尝试了

我看了很多,找不到为什么会这样。这很简单,但不起作用

:numbers
cls
set /p first=First:
set /p second=Second:
set /p third=Third:
set /p fourth=Fourth:
set /p fifth=Fifth:
goto solve
:solve
cls
set /a s-f= %second% - %first%
set /a t-s= %third% - %second%

但最后两行不起作用,我知道这是因为我尝试了echo%variable\u name%,它显示为我想要的,但/a不起作用。

s-f
不是有效的变量名。如果改用
s\u f
,该变量将被适当设置。

好的,从一般意义上讲,它是一个有效的环境变量名称,但该名称不能在set/a语句中使用。SET/A要求名称不包含数学运算符或分隔符。谢谢,我不知道这一点,我会记住的