如何通过命令行设置windows服务用户名和密码 [英] how to set windows service username and password through commandline

查看:399
本文介绍了如何通过命令行设置windows服务用户名和密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 sc 命令,我们可以查询,启动,停止Windows服务。

例如:

Using sc command we can query, start , stop windows services.
For ex:

sc query "windows service name"

sc config 命令更改服务的配置,但我不知道如何使用它。

The sc config command changes the configuration of the service, but I don't know how to use it.

有人可以告诉我如何设置任何Windows服务的用户名和密码?

Could someone tell me how we can set the username and password for any windows service?

推荐答案

这样做:

sc.exe config "[servicename]" obj= "[.\username]" password= "[password]"

真正的论据。 (保留引号,但不要括号。)

Where each of the [bracketed] items are replaced with the true arguments. (Keep the quotes, but don't keep the brackets.)

请记住:


  • 上面示例中的间距很重要。 obj =foo是正确的; obj =foo不是。

  • '。'是本地机器的别名,

  • 请输入您的参数,如上所示。
  • 如果您需要,请输入密码。你有时可以不用引号,但祝你好运。
  • The spacing in the above example matters. obj= "foo" is correct; obj="foo" is not.
  • '.' is an alias to the local machine, you can specify a domain there (or your local computer name) if you wish.
  • Passwords aren't validated until the service is started
  • Quote your parameters, as above. You can sometimes get by without quotes, but good luck.

这篇关于如何通过命令行设置windows服务用户名和密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆