Using Inno Setup to Install Xojo System Service?

I know this a little off topic but I know some of you on here have used Inno Setup in the past and I thought I would just ask. I’m having some trouble using sc.exe to install my Xojo console/service using Inno Setup. Is there anyone on here that might have some experience doing this that I could ask to take a look at my script and tell me what I’m doing wrong? Thanks.

I haven’t used Inno Setup but this code works when registering the service from app just in case it helps. Can you verify what kind of string Inno constructs?

    dim sh as new shell
    dim path as string
    path = CHR(34)+serv.AbsolutePath+CHR(34)
    
    sh.execute("sc create SysMonitor binpath= "+path+" start= auto DisplayName= SysMonitor")
    
    if sh.ErrorCode<>0 then
      MsgBox "Shell error "+str(sh.errorcode)+" when adding service"
    end
    
    sh.close

That’s actually really helpful to me because I need to be able to start and restart the app from a Xojo program after install. Can I restart and stop the service like your example with sc.exe?

Yes, you can just instantiate shell again and then call sh.execute(“sc stop SysMonitor”). I use that in a config utility that also removes the service (“sc delete SysMonitor”) if the config changes so that the new setup can be load. The shell is actually quite useful, especially if you use the return codes as well.

My Inno Script looks like this and the path contains spaces so that may be part of my issue it keeps failing with a process exit code 1639.

[code][Run]
Filename: {sys}\sc.exe; Parameters: “create My App start= auto binPath= “”{app}\My App Program v0.0.1.exe”"" ; Flags: runhidden

[UninstallRun]
Filename: {sys}\sc.exe; Parameters: “stop My App” ; Flags: runhidden
Filename: {sys}\sc.exe; Parameters: “delete My App” ; Flags: runhidden [/code]

My file path also has spaces because it’s on 64 bit WIndows:
C:\Program Files (x86)\My App\My App Program v0.0.1.exe

Well as long as sc.exe gets the double quotes before and after path it shouldn’t be a problem. Is there any log or anything that would help to see what is the actual string that Inno sends to shell?

Thanks for the info. Yes it just tells me that it failed with a process exit code 1639. I looked it up online and didn’t find very much. I appreciate your help.

1639 is invalid command line parameter (sometimes). The problem could be the space in create -parameter… do a quick test using MyApp instead of My App. The binpath probably is ok.

Ok thanks I’ll give that a try.