5

我正在尝试关注此网站并安装我们作为服务提供的程序。

这就是我所拥有的:

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

当我按下回车键时,它给了我帮助:

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>

我已经将帮助与我所拥有的进行了比较,我认为它没有任何问题。这是在 Windows 7 x64 系统上。

有人看到我做错了吗?

4

4 回答 4

15

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

于 2016-06-10T13:45:29.197 回答
3
于 2013-04-23T16:45:38.760 回答
2
于 2019-10-09T12:44:51.087 回答
0

In my case, I had not escaped one of the internal double quotes.

Had:

sc config postgresql-x64-13 start= auto displayname= "PostgreSQL Server 13" binPath= "\"C:\Program Files\PostgreSQL\13\bin\pg_ctl.exe\" runservice -N \"postgresql-x64-13\" -D \"D:\PostgreSQL\13\data" -w"

Needed to escape the end double quote after D:\PostgreSQL\data:

sc config postgresql-x64-13 start= auto displayname= "PostgreSQL Server 13" binPath= "\"C:\Program Files\PostgreSQL\13\bin\pg_ctl.exe\" runservice -N \"postgresql-x64-13\" -D \"D:\PostgreSQL\13\data\" -w"

The error message was the same:

"A space is required between the equal sign and the value."

And, it was not helpful at all.

于 2021-03-22T13:43:41.307 回答