'else' 不是内部或外部命令,也不是可运行的程序或批处理文件 [英] 'else' is not recognized as an internal or external command, operable program or batch file
问题描述
我尝试使用else"命令,但出现以下错误:
I try to use with "else" command but I get the foloowing error:
'else' 不被识别为内部或外部命令,可运行的程序或批处理文件.
我的代码是:
if "zz"=="TRUE" (
copy /a zz + /a ee=/a zz
)
else (
copy /a e + /a %TMP%=/a e
)
什么问题?
推荐答案
else
需要与 在同一行"(a)如果
.像这样删除 else
之前的换行符:
The else
needs to be on the same "line" (a) as the if
. Remove the new-line before the else
like so:
if "zz"=="TRUE" (
copy /a zz + /a ee=/a zz
) else (
copy /a e + /a %TMP%=/a e
)
另请注意 "zz"=="TRUE"
永远不会评估为 true
- 我怀疑你的意思是 "%zz%"=="真的"
?
Please also note that "zz"=="TRUE"
will never evaluate to true
- I suspect you meant "%zz%"=="TRUE"
?
(a):这并不总是一个好的描述,尽管它是 Microsoft 文档中使用的.相同的 command 可能会更好,将 )
和 else
放在不同的行上将其分成两个命令.
(a): This isn't always a good description, though it's what the Microsoft documents use. Same command may have been better, and putting )
and else
on a different line breaks it into two commands.
这篇关于'else' 不是内部或外部命令,也不是可运行的程序或批处理文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!