Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cannot get sc.exe to work for my program

I am trying to follow this website and install a program we have as a service.

This is what I have:

SC CREATE SqlPort binPath= “D:\RPG\VbLib\SqlPort\SqlPort\srvstart.exe SqlPort -c D:\RPG\VbLib\SqlPort\SqlPort\sqlport.ini” DisplayName= SqlPort start= auto

When I hit enter, it gives me the help:

DESCRIPTION:
        Creates a service entry in the registry and Service Database.
USAGE:
        sc <server> create [service name] [binPath= ] <option1> <option2>...

OPTIONS:
NOTE: The option name includes the equal sign.
      A space is required between the equal sign and the value.
 type= <own|share|interact|kernel|filesys|rec>
       (default = own)
 start= <boot|system|auto|demand|disabled|delayed-auto>
       (default = demand)
 error= <normal|severe|critical|ignore>
       (default = normal)
 binPath= <BinaryPathName>
 group= <LoadOrderGroup>
 tag= <yes|no>
 depend= <Dependencies(separated by / (forward slash))>
 obj= <AccountName|ObjectName>
       (default = LocalSystem)
 DisplayName= <display name>
 password= <password>

I've compared the help to what I have and I don't see any problems with it. This is on a Windows 7 x64 system.

Anyone see what I am doing wrong?

like image 280
ErocM Avatar asked Apr 23 '13 16:04

ErocM


1 Answers

I've had this exact problem and my quotation marks were fine... Finally figured it out -- there must be a space after the '=' !

I.e. this was not working/causing the 'help' dump:

C:\>sc create "My Service" binPath="C:\MyService\MyService.exe"

But this worked:

C:\>sc create "My Service" binPath= "C:\MyService\MyService.exe"

The behavior depicted in the original question is more "generic" than improper quotation marks. It is how the OS reacts to commands that were improperly formatted in any way. It could be any non-ANSI character, or some other problem with the command format (e.g. misspelling "binPath", etc.)

like image 184
taiji123 Avatar answered Nov 09 '22 05:11

taiji123