使用SC安装Windows服务

dis*_*ive 1 windows powershell cmd

我正在使用该installutils命令安装一些服务,但是我在使用该命令安装这些服务时遇到了巨大的麻烦SC create.这两种模式有什么区别.我从命令中得到没有错误,但是有一系列选项.这是我使用的格式:

SC create ZAM displayname= "ZAM" binpath="E:\ZAM\ZAM.exe" start=auto 
Run Code Online (Sandbox Code Playgroud)

我得到以下内容:

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>
Run Code Online (Sandbox Code Playgroud)

我不明白会出现什么问题?

Eri*_*ris 6

我建议使用,而不是直接调用'sc' New-Service.参数是直接翻译.它在默认的PowerShell模块中可用.


MC *_* ND 5

这个问题很常见。sc 命令中带有等号的所有参数必须具有相同的格式:

parameter=<SPACE>value
Run Code Online (Sandbox Code Playgroud)

照原样。需要空间