Windows自带一个控制服务的命令-SC,下面用Terminal Service做个简单例子:
查询Terminal Service的配置
C:\Users\jackie.chen>sc qc termservice [SC] QueryServiceConfig SUCCESS
SERVICE_NAME: termservice           TYPE               : 20  WIN32_SHARE_PROCESS            START_TYPE         : 2   AUTO_START            ERROR_CONTROL      : 1   NORMAL            BINARY_PATH_NAME   : C:\Windows\System32\svchost.exe -k NetworkService            LOAD_ORDER_GROUP   :            TAG                : 0            DISPLAY_NAME       : Terminal Services            DEPENDENCIES       : RPCSS                               : TermDD            SERVICE_START_NAME : NT Authority\NetworkService
关闭Terminal Service服务
C:\Users\jackie.chen>sc stop termservice
SERVICE_NAME: termservice           TYPE               : 20  WIN32_SHARE_PROCESS            STATE              : 3  STOP_PENDING                                    (STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)            WIN32_EXIT_CODE    : 0  (0x0)            SERVICE_EXIT_CODE  : 0  (0x0)            CHECKPOINT         : 0x1            WAIT_HINT          : 0xea60
查询Terminal Service服务
C:\Users\jackie.chen>sc query termservice
SERVICE_NAME: termservice           TYPE               : 20  WIN32_SHARE_PROCESS            STATE              : 1  STOPPED            WIN32_EXIT_CODE    : 0  (0x0)            SERVICE_EXIT_CODE  : 0  (0x0)            CHECKPOINT         : 0x0            WAIT_HINT          : 0x0
启动Terminal Service服务
C:\Users\jackie.chen>sc start termservice
SERVICE_NAME: termservice           TYPE               : 20  WIN32_SHARE_PROCESS            STATE              : 2  START_PENDING    (NOT_STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)         WIN32_EXIT_CODE    : 0  (0x0)            SERVICE_EXIT_CODE  : 0  (0x0)            CHECKPOINT         : 0x0            WAIT_HINT          : 0x7d0            PID                : 1456            FLAGS              :
查询Terminal Service服务的显示名称
C:\Users\jackie.chen>sc getdisplayname termservice     [SC] GetServiceDisplayName SUCCESS    Name = Terminal Services
更多用法:
        sc <server> [command] [service name] <option1> <option2>...
        The option <server> has the form \\ServerName (用于控制远程机器上的Windows服务)           Further help on commands can be obtained by typing: "sc [command]"            Commands:              query-----------Queries the status for a service, or enumerates the status for types of services.              queryex---------Queries the extended status for a service, or enumerates the status for types of services.              start-----------Starts a service.              pause-----------Sends a PAUSE control request to a service.              interrogate-----Sends an INTERROGATE control request to a service.              continue--------Sends a CONTINUE control request to a service.              stop------------Sends a STOP request to a service.              config----------Changes the configuration of a service (persistent).              description-----Changes the description of a service.              failure---------Changes the actions taken by a service upon failure.              failureflag-----Changes the failure actions flag of a service.              sidtype---------Changes the service SID type of a service.              privs-----------Changes the required privileges of a service.              qc--------------Queries the configuration information for a service.              qdescription----Queries the description for a service.              qfailure--------Queries the actions taken by a service upon failure.              qfailureflag----Queries the failure actions flag of a service.              qsidtype--------Queries the service SID type of a service.              qprivs----------Queries the required privileges of a service.              delete----------Deletes a service (from the registry).              create----------Creates a service. (adds it to the registry).              control---------Sends a control to a service.              sdshow----------Displays a service's security descriptor.              sdset-----------Sets a service's security descriptor.              showsid---------Displays the service SID string corresponding to an arbitrary name.              GetDisplayName--Gets the DisplayName for a service.              GetKeyName------Gets the ServiceKeyName for a service.              EnumDepend------Enumerates Service Dependencies.
        The following commands don't require a service name:           sc <server> <command> <option>              boot------------(ok | bad) Indicates whether the last boot should                              be saved as the last-known-good boot configuration              Lock------------Locks the Service Database              QueryLock-------Queries the LockStatus for the SCManager Database

SC-控制Windows服务的命令的更多相关文章

  1. 玩转Windows服务系列——命令行管理Windows服务

    说到Windows服务的管理就不得不说通过命令行的方式管理Windows服务,因为无论是系统管理员,还是通过编程的方式调用cmd命令,命令行都是非常方便以及强大的工具. 接下来就看一下如何通过cmd命 ...

  2. 玩转Windows服务系列——命令行管理Windows服务

    原文:玩转Windows服务系列——命令行管理Windows服务 说到Windows服务的管理就不得不说通过命令行的方式管理Windows服务,因为无论是系统管理员,还是通过编程的方式调用cmd命令, ...

  3. [转]玩转Windows服务系列——命令行管理Windows服务

    本文转自:http://www.cnblogs.com/hbccdf/p/managewindowsservicewithcmd.html 说到Windows服务的管理就不得不说通过命令行的方式管理W ...

  4. C# ASP.NET 控制windows服务的 开启和关闭 以及重启

    用ASP.NET控制Windows服务的开启与关闭效果如图 代码 首页页面需要添加引用 页面的pageload中 实例化windows服务 protected void Page_Load(objec ...

  5. C#使用ServiceController控制windows服务

    C#在,使用ServiceController控制类windows服务,添加首次使用前引文:System.ServiceProcess,空间中引用:using System.ServiceProces ...

  6. Windows服务安装命令:

    sc create YY.SmsPlatform.RemoteDataCenter binPath= "E:\YY.SmsPlatform\YY.SmsPlatform.RemoteData ...

  7. Windows服务BAT命令-安装、卸载、启动、停止

    1.安装服务 %SystemRoot%\Microsoft.NET\Framework\v4.0.30319\installutil.exe D:\WiseMES\MES.WindowsService ...

  8. 二种方法安装卸载Windows服务的命令

    第一种方法:通过Dos命令安装系统服务1. 开始 运行输入 cmd 进入dos窗口2. cd命令进入到C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727目录下, ...

  9. 项目Windows服务安装命令:

    sc create YY.SmsPlatform.RemoteDataCenter binPath= "E:\YY.SmsPlatform\YY.SmsPlatform.RemoteData ...

随机推荐

  1. 1st-code-review summary

    每次做code review,先贤谆谆教诲便在耳畔响起: "There are only two hard problems in Computer Science: cache inval ...

  2. Windows2008 R2修改3389端口教程

    默认的3389端口有必要修改么,这个端口,我建议是修改一下为好,最好改大一点,这样安全性会高一点,但然面对高手级攻击,就没有用了,通常高手级过NMAP扫描一个你的IP地址,端便全然显现出来了,好了,下 ...

  3. Bootstrap插件1--tooltip

    在引入bootstrap.js之前我们需要引入jquery的js文件 既然是bootstrap的插件,那么自然需要引用bootstrap.js和bootstrap.css这2个核心文件了 这里了主要介 ...

  4. OpenMP并行编程

    什么是OpenMP?“OpenMP (Open Multi-Processing) is an application programming interface (API) that support ...

  5. SQL查询语句中的 limit offset(转 )

    经常用到在数据库中查询中间几条数据的需求 比如下面的sql语句: ① selete * from testtable limit 2,1; ② selete * from testtable limi ...

  6. 【php学习】时间函数

    手工画了一张图,来大体概括php中对于时间的处理函数 首先时间戳是这样“1441202665”的一串数字,虽然人看起来麻烦,但是计算机却很容易识别这样的时间表示形式. 所以给计算机看的时间是时间戳,给 ...

  7. getComputedStyle()与currentStyle

    getComputedStyle()与currentStyle计算元素样式 发表于 2011-10-27 由 admin “DOM2级样式”增强了document.defaultView,提供了get ...

  8. LINQ延迟查询的例子

    //linq延迟查询.两次查询结果不同 List<string> l = new List<string>() { "aaa", "bbb&quo ...

  9. strlen

    char c1[] = "sdfa";//系统自动添加结束字符 \0 char c2[] = {'1','2','3'};//这样赋值的话,要自己加上结束字符 \0 printf( ...

  10. mongoDB命令

    . getLastError db.runCommand({getLastError:}) . buildInfo //返回mongoDB的服务器版本号和操作系统类型 db.runCommand({} ...