'else' 不是内部或外部命令,也不是可运行的程序或批处理文件 [英] 'else' is not recognized as an internal or external command, operable program or batch file

查看:55
本文介绍了'else' 不是内部或外部命令,也不是可运行的程序或批处理文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用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屋!

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