Allen's profileLi's spacePhotosBlog Tools Help

Blog


    June 25

    Windows服务相关命令

    样例1,手工添加MSSQLServer2005为服务:
    sc create MSSQLSERVER binpath= "C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Binn\sqlservr.exe -sMSSQLSERVER" displayname= "SQL Server (MSSQLSERVER)"

    描述:
            SC 是用于与
            服务控制管理器和服务进行通信的命令行程序。
    用法:
            sc <server> [command] [service name] <option1> <option2>...

            选项 <server> 的格式为 "\\ServerName"
            可以键入 "sc [command]" 以获得命令的进一步帮助
            命令:
              query-----------查询服务的状态, 或
                              枚举服务类型的状态。
              queryex---------查询服务的扩展状态, 或
                              枚举服务类型的状态。
              start-----------启动服务。
              pause-----------向服务发送 PAUSE 控制请求。
              interrogate-----向服务发送 INTERROGATE 控制请求。
              continue--------向服务发送 CONTINUE 控制请求。
              stop------------向服务发送 STOP 请求。
              config----------更改服务的配置(永久)。
              description-----更改服务的描述。
              failure---------更改服务失败时所进行的操作。
              sidtype---------更改服务的服务 SID 类型。
              qc--------------查询服务的配置信息。
              qdescription----查询服务的描述。
              qfailure--------查询服务失败时所进行的操作。
              qsidtype--------查询服务的服务 SID 类型。
              delete----------(从注册表)删除服务。
              create----------创建服务(将其添加到注册表)。
              control---------向服务发送控制。
              sdshow----------显示服务的安全描述符。
              sdset-----------设置服务的安全描述符。
              showsid---------显示与
                              任意名称相对应的服务 SID 字符串。
              GetDisplayName--获取服务的 DisplayName。
              GetKeyName------获取服务的 ServiceKeyName。
              EnumDepend------枚举服务的依存关系。

            下列命令不要求服务名称:
            sc <server> <command> <option>
              boot------------(ok | bad) 表明是否将最后一次启动
                              保存为最后一次的正确启动配置
              Lock------------锁定服务数据库
              QueryLock-------查询 SCManager 数据库的 LockStatus
    示例:
            sc start MyService

    Comments (1)

    Please wait...
    Sorry, the comment you entered is too long. Please shorten it.
    You didn't enter anything. Please try again.
    Sorry, we can't add your comment right now. Please try again later.
    To add a comment, you need permission from your parent. Ask for permission
    Your parent has turned off comments.
    Sorry, we can't delete your comment right now. Please try again later.
    You've exceeded the maximum number of comments that can be left in one day. Please try again in 24 hours.
    Your account has had the ability to leave comments disabled because our systems indicate that you may be spamming other users. If you believe that your account has been disabled in error please contact Windows Live support.
    Complete the security check below to finish leaving your comment.
    The characters you type in the security check must match the characters in the picture or audio.

    To add a comment, sign in with your Windows Live ID (if you use Hotmail, Messenger, or Xbox LIVE, you have a Windows Live ID). Sign in


    Don't have a Windows Live ID? Sign up

    Yorkwrote:
    不好意思,偷学一招!
    Sept. 13

    Trackbacks

    The trackback URL for this entry is:
    http://lislog.spaces.live.com/blog/cns!29F76575168CBBB9!256.trak
    Weblogs that reference this entry
    • None