NSIS变量不允许在define变量中使用空格

时间:2014-12-19 12:07:21

标签: nsis

 **define POSTGRESQL_INSTALLATION_DIRECTORY "C:\Program Files\Postgre SQL\9.3"**

NSIS varible不允许下面声明的变量中的空格。

[INFO] [MAKENSIS] DetailPrint expects 1 parameters, got 2.
[INFO] [MAKENSIS] Usage: DetailPrint message
[ERROR] Failed to execute goal org.codehaus.mojo:nsis-maven-plugin:1.0-SNAPSHOT:compile (64bit_REACH) on project dsr.installer: Execution of makensis compiler failed. See output above for details. -> [Help 1]

如果我定义没有空格的变量,它可以正常工作:

 `**define POSTGRESQL_INSTALLATION_DIRECTORY "C:\ProgramFiles\PostgreSQL\9.3"**`

但我希望声明变量之间的空格如

`**define POSTGRESQL_INSTALLATION_DIRECTORY "C:\Program Files\Postgre SQL\9.3"**` 

所以请告诉我如何执行这个定义的变量。

1 个答案:

答案 0 :(得分:1)

编译器告诉你问题,DetailPrint指令接受1个参数,当没有正确引用带空格的字符串时,它将被解释为多个参数。

!define POSTGRESQL_INSTALLATION_DIRECTORY "C:\Program Files\PostgreSQL\9.3"

Section
;DetailPrint ${POSTGRESQL_INSTALLATION_DIRECTORY} ; This will not work because the string is not quoted
DetailPrint "${POSTGRESQL_INSTALLATION_DIRECTORY}"
DetailPrint '${POSTGRESQL_INSTALLATION_DIRECTORY}'
DetailPrint "Hello ${POSTGRESQL_INSTALLATION_DIRECTORY} World"
DetailPrint 'Hello "${POSTGRESQL_INSTALLATION_DIRECTORY}" World'
DetailPrint "Hello $\"${POSTGRESQL_INSTALLATION_DIRECTORY}$\" World"
SectionEnd