首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法让sc.exe为我的程序工作

无法让sc.exe为我的程序工作
EN

Stack Overflow用户
提问于 2013-04-24 00:40:40
回答 4查看 6.7K关注 0票数 5

我正在尝试跟随this website并安装一个我们有作为服务的程序。

这就是我所拥有的:

代码语言:javascript
复制
SC CREATE SqlPort binPath= “D:\RPG\VbLib\SqlPort\SqlPort\srvstart.exe SqlPort -c D:\RPG\VbLib\SqlPort\SqlPort\sqlport.ini” DisplayName= SqlPort start= auto

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

代码语言:javascript
复制
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>

我已经将帮助与我所拥有的进行了比较,我看不出有任何问题。这是在Windows7 x64系统上。

有人看到我做错了什么吗?

EN

回答 4

Stack Overflow用户

回答已采纳

发布于 2013-04-24 00:45:39

粘贴的文本中有。您可能希望尝试用普通的"引号替换它们。

票数 3
EN

Stack Overflow用户

发布于 2016-06-10 21:45:29

我遇到过这样的问题,我的引号也没问题...终于弄明白了-- '=‘后面必须有一个空格!

也就是说,这不起作用/导致'help‘转储:

代码语言:javascript
复制
C:\>sc create "My Service" binPath="C:\MyService\MyService.exe"

但这是可行的:

代码语言:javascript
复制
C:\>sc create "My Service" binPath= "C:\MyService\MyService.exe"

原始问题中描述的行为比不适当的引号更“通用”。它是操作系统对以任何方式不正确格式化的命令的反应方式。它可能是任何非ANSI字符,也可能是命令格式的其他问题(例如"binPath“拼写错误等)。

票数 15
EN

Stack Overflow用户

发布于 2019-10-09 20:44:51

有三件事非常重要。

应该编写

  1. binPath= "而不是binPath="binPath = "

关注空间

必须正确编写的

  1. "

不正确,"正确

以administrator身份运行

  1. cmd.exe

示例

代码语言:javascript
复制
sc create "Service Name" binPath= "E:\ServiceFolder\ServiceName.exe"

还要注意,您还需要为每个可选属性提供一个空格。

例如,start=auto应为start= auto

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/16174736

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档