""此时出人意料

时间:2015-09-28 15:20:52

标签: batch-file if-statement set

我已经在下面粘贴了一部分脚本,我看到设置AJPPort的问题。这是为了在脚本中进一步提取一个设置,值为8009.如果我愿意,可以选择更改它,因此为什么我在脚本中有这个。但是目前它正在给我错误=""这时出人意料。如果不是"!AJP!" =""。我尝试过改为如果不是"!AJP!" ==""但没有运气。我也设置了ENABLEDELAYEDEXPANSION。

if "!InstallApache!"=="Y" (
    if "!HOLMESAuditMailbox!"=="" (
        set /p HOLMESAuditMailbox="Enter email address for alerting  : "
        echo HOLMESAuditMailbox=!HOLMESAuditMailbox!>> %SETTINGS_FILE%
)

if "!AJPHost!"=="" (
    set /p AJPHost="Enter Apache Proxy Destination Host    [localhost]: "
    if "!AJPHost!"=="" set AJPHost=localhost
    echo AJPHost=!AJPHost!>> %SETTINGS_FILE%
)

if "!AJPPort!"=="" (
if NOT "!AJP!"="" (
        AJPPort=!AJP!
    ) else (
        AJPPort=8009
    )
    set /p AJPPort="Enter Apache AJP Proxy Port    [!AJPPort!]: "
    echo AJPPort=!AJPPort!>> %SETTINGS_FILE%
)

1 个答案:

答案 0 :(得分:4)

更改

if "!AJPPort!"=="" (
if NOT "!AJP!"="" (

if "!AJPPort!"=="" (
if NOT "!AJP!"=="" (