具有很长参数列表的NSIS Exec命令被下一行切断(NSIS Exec command with very long parameter list being cut off by the next

编程入门 行业动态 更新时间:2024-10-27 16:39:45
具有很长参数列表的NSIS Exec命令被下一行切断(NSIS Exec command with very long parameter list being cut off by the next line)

在我的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"' SectionEnd

NSIS 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

更多推荐

本文发布于:2023-07-16 07:46:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1125542.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:很长   命令   参数   列表   Exec

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!