)此时出人意料

时间:2012-12-04 16:26:21

标签: batch-file parentheses

我在重命名之前使用以下代码检查文件,如果没有,请检查另一个文件以显示消息。

SET offline=1
IF EXIST %webroot%\%sitename%\app_offline.htm.scheduled (
    call :displayMsg "Taking %sitename% website offline"
    ::                =================================
    REN %webroot%\%sitename%\app_offline.htm.scheduled app_offline.htm
) ELSE (
    IF EXIST %webroot%\%sitename%\app_offline.htm (
        call :displayMsg "%sitename% website is already offline"
        ::                =====================================
    )
)

但是正在返回以下内容

D:\Company\DeploymentFolder>SET offline=1
) was unexpected at this time.

D:\Company\DeploymentFolder>        )

我看不到括号中的问题?谁能看到我错在哪里?

1 个答案:

答案 0 :(得分:0)

::条评论替换为REM,它应该有效。 你可以使用::但是你需要知道Labels in parenthesis两行规则