I want to allow paths with spaces (for example program files
) when installing my program with Inno Setup. However paths with spaces let my installed service crash.
The Inno Setup file looks like this:
[Setup]
AppName=Demo
DefaultDirName={pf}\demo
[Files]
Source: "bin\nssm.exe"; DestDir: "{app}"
Source: "bin\jdk1.8.0_152\jre\*"; DestDir: "{app}\jre"; Flags: recursesubdirs
Source: "build\libs\demo.jar"; DestDir: "{app}"
[Run]
Filename: "{app}\nssm.exe"; \
Parameters: "install demo ""{app}\jre\bin\java.exe"" -jar ""{app}\demo.jar"""
Filename: "{app}\nssm.exe"; Parameters: "start demo"
"nssm.exe" is a service wrapper to execute a java application as a windows service.
The critical part is this line:
Filename: "{app}\nssm.exe"; \
Parameters: "install demo ""{app}\jre\bin\java.exe"" -jar ""{app}\demo.jar"""
As suggested in this question/answer, I tried to use double double quotes, but this doesn't help, the service is still crashing. If I change DefaultDirName
to a path without spaces everything works as expected.
DefaultDirName=c:\demo
How do I have to handle paths with spaces?
nssm.exe
ordemo.jar
), rather than with the installer? Can you even run"C:\Program Files\Demo\nssm.exe" install demo "C:\Program Files\Demo\jre\bin\java.exe" -jar "C:\Program Files\Demo\demo.jar"
from Windows command-line? – Martin Prikryl