在我的NSIS脚本中,我有以下几行(没有将第一行转换为代码块,因为它太长并且看起来很糟糕为1行):
Exec'“$ BINDIR \ SubscriberACD.exe”// IS // SubscriberACD --Install =“$ BINDIR \ SubscriberACD.exe”--Description =“Apache Commons Daemon的订阅服务”--Jvm =“$ JVMDIR \ jvm。 dll“--Classpath =”$ CLASSESDIR \ SubscriberACD.jar; $ CLASSESDIR \ jeromq-0.3.5.jar; $ CLASSESDIR \ jackson-databind-2.6.3.jar; $ CLASSESDIR \ jackson-core-2.6.3.jar ; $ CLASSESDIR \杰克逊的注解-2.6.0.jar; $ CLASSESDIR \管理为核心的util-4.1.2.jar; $ CLASSESDIR \管理测量用4.1.2.jar; $ CLASSESDIR \管理,测量,检查站-writer-1.0.jar; $ CLASSESDIR \ jna-4.2.2.jar; $ CLASSESDIR \ jna-platform-4.2.2.jar“--StartMode = jvm --StartClass = SubscriberACD.Subscriber --StartMethod = windowsService - StartParams = start --StopMode = jvm --StopClass = SubscriberACD.Subscriber --StopMethod = windowsService --StopParams = stop --LogPath =“$ INSTDIR \ SubscriberACD \ logs”--StdOutput = auto --StdError = auto'
Sleep 5000 ExecWait '"sc" config SubscriberACD start=" auto"'不知何故,当我查看我的NSIS日志时,我看到以下内容:
执行:“C:\ Program Files(x86)\ MyProduct \ SubscriberACD \ bin \ SubscriberACD.exe”// IS // SubscriberACD --Install =“C:\ Program Files(x86)\ MyProduct \ SubscriberACD \ bin \ SubscriberACD。 exe“--Description =”Apache Commons Daemon的订阅服务“ - Jvm =”C:\ Program Files(x86)\ MyProduct \ SubscriberACD \ jdk7 \ jre \ bin \ server \ jvm.dll“--Classpath =”C :\ Program Files(x86)\ MyProduct \ SubscriberACD \ classes \ SubscriberACD.jar; C:\ Program Files(x86)\ MyProduct \ SubscriberACD \ classes \ jeromq-0.3.5.jar; C:\ Program Files(x86)\ MyProduct \ SubscriberACD \ classes \ jackson-databind-2.6.3.jar; C:\ Program Files(x86)\ MyProduct \ SubscriberACD \ classes \ jackson-core-2.6.3.jar; C:\ Program Files(x86)\ MyProduct \ SubscriberACD \ classes \ jackson-annotations-2.6.0.jar; C:\ Program Files(x86)\ MyProduct \ SubscriberACD \ classes \ management-core-util-4.1.2.jar; C:\ Program Files(x86 )\ MyProduct \ SubscriberACD \ classes \ management-measurement-4.1.2.jar; C:\ PrograExecute:“sc” config SubscriberACD start = auto
请注意NSIS如何组合这两行并实际覆盖了第一行中的一些内容。 关于导致这个问题的任何想法? NSIS不喜欢带有长参数的命令吗?
最初,我使用ExecWait作为我的第一个命令。 当我看到同样的问题时,我切换到使用Exec,然后在之后添加了Sleep 5000,睡眠5秒,因为我认为这可能是一个计时问题。
我仔细检查了我的引号,以确保它们匹配。
In my NSIS script, I have the following lines (Didn't turn the 1st line into a code block because it was too long and looked bad as 1 line):
Exec '"$BINDIR\SubscriberACD.exe" //IS//SubscriberACD --Install="$BINDIR\SubscriberACD.exe" --Description="Subscriber service with Apache Commons Daemon" --Jvm="$JVMDIR\jvm.dll" --Classpath="$CLASSESDIR\SubscriberACD.jar;$CLASSESDIR\jeromq-0.3.5.jar;$CLASSESDIR\jackson-databind-2.6.3.jar;$CLASSESDIR\jackson-core-2.6.3.jar;$CLASSESDIR\jackson-annotations-2.6.0.jar;$CLASSESDIR\management-core-util-4.1.2.jar;$CLASSESDIR\management-measurement-4.1.2.jar;$CLASSESDIR\management-measurement-checkpoint-writer-1.0.jar;$CLASSESDIR\jna-4.2.2.jar;$CLASSESDIR\jna-platform-4.2.2.jar" --StartMode=jvm --StartClass=SubscriberACD.Subscriber --StartMethod=windowsService --StartParams=start --StopMode=jvm --StopClass=SubscriberACD.Subscriber --StopMethod=windowsService --StopParams=stop --LogPath="$INSTDIR\SubscriberACD\logs" --StdOutput=auto --StdError=auto'
Sleep 5000 ExecWait '"sc" config SubscriberACD start=" auto"'Somehow, when I look at my NSIS logs, I see the following:
Execute: "C:\Program Files (x86)\MyProduct\SubscriberACD\bin\SubscriberACD.exe" //IS//SubscriberACD --Install="C:\Program Files (x86)\MyProduct\SubscriberACD\bin\SubscriberACD.exe" --Description=" Subscriber service with Apache Commons Daemon" --Jvm="C:\Program Files (x86)\MyProduct\SubscriberACD\jdk7\jre\bin\server\jvm.dll" --Classpath="C:\Program Files (x86)\MyProduct\SubscriberACD\classes\SubscriberACD.jar;C:\Program Files (x86)\MyProduct\SubscriberACD\classes\jeromq-0.3.5.jar;C:\Program Files (x86)\MyProduct\SubscriberACD\classes\jackson-databind-2.6.3.jar;C:\Program Files (x86)\MyProduct\SubscriberACD\classes\jackson-core-2.6.3.jar;C:\Program Files (x86)\MyProduct\SubscriberACD\classes\jackson-annotations-2.6.0.jar;C:\Program Files (x86)\MyProduct\SubscriberACD\classes\management-core-util-4.1.2.jar;C:\Program Files (x86)\MyProduct\SubscriberACD\classes\management-measurement-4.1.2.jar;C:\PrograExecute: "sc" config SubscriberACD start= auto
Notice how NSIS combined the two lines and actually overwrote some of the content from the first line. Any ideas on on what is causing this? Does NSIS not like commands with long parameters?
Originally, I used ExecWait for my first command. When I was seeing the same problem, I switch to using Exec and then added a Sleep 5000 after that to sleep for 5 seconds since I thought it might have been a timing issue.
I double checked my quotation marks to make sure that they match.
最满意答案
默认情况下,NSIS具有1024个字符的限制。 我猜想当$ INSTDIR扩展时你超过了这个限制。 您可以下载大型字符串构建或执行批处理文件:
Section InitPluginsDir FileOpen $0 "$PluginsDir\test.cmd" w FileWrite $0 '@echo off$\n' ; Write out example command in pieces: FileWrite $0 '"$sysdir\forfiles.exe"' FileWrite $0 ' /P "$windir" /S' FileWrite $0 ' /M "*shell32*"$\n' FileClose $0 ExecWait '"$PluginsDir\test.cmd"' SectionEndNSIS has a 1024 character limit by default. I'm guessing when $INSTDIR is expanded you exceed that limit. You can download the large string build or execute a batch file instead:
Section InitPluginsDir FileOpen $0 "$PluginsDir\test.cmd" w FileWrite $0 '@echo off$\n' ; Write out example command in pieces: FileWrite $0 '"$sysdir\forfiles.exe"' FileWrite $0 ' /P "$windir" /S' FileWrite $0 ' /M "*shell32*"$\n' FileClose $0 ExecWait '"$PluginsDir\test.cmd"' SectionEnd更多推荐
发布评论