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 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