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
- 玩转Windows服务系列——命令行管理Windows服务
说到Windows服务的管理就不得不说通过命令行的方式管理Windows服务,因为无论是系统管理员,还是通过编程的方式调用cmd命令,命令行都是非常方便以及强大的工具. 接下来就看一下如何通过cmd命 ...
- 玩转Windows服务系列——命令行管理Windows服务
原文:玩转Windows服务系列——命令行管理Windows服务 说到Windows服务的管理就不得不说通过命令行的方式管理Windows服务,因为无论是系统管理员,还是通过编程的方式调用cmd命令, ...
- [转]玩转Windows服务系列——命令行管理Windows服务
本文转自:http://www.cnblogs.com/hbccdf/p/managewindowsservicewithcmd.html 说到Windows服务的管理就不得不说通过命令行的方式管理W ...
- C# ASP.NET 控制windows服务的 开启和关闭 以及重启
用ASP.NET控制Windows服务的开启与关闭效果如图 代码 首页页面需要添加引用 页面的pageload中 实例化windows服务 protected void Page_Load(objec ...
- C#使用ServiceController控制windows服务
C#在,使用ServiceController控制类windows服务,添加首次使用前引文:System.ServiceProcess,空间中引用:using System.ServiceProces ...
- Windows服务安装命令:
sc create YY.SmsPlatform.RemoteDataCenter binPath= "E:\YY.SmsPlatform\YY.SmsPlatform.RemoteData ...
- Windows服务BAT命令-安装、卸载、启动、停止
1.安装服务 %SystemRoot%\Microsoft.NET\Framework\v4.0.30319\installutil.exe D:\WiseMES\MES.WindowsService ...
- 二种方法安装卸载Windows服务的命令
第一种方法:通过Dos命令安装系统服务1. 开始 运行输入 cmd 进入dos窗口2. cd命令进入到C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727目录下, ...
- 项目Windows服务安装命令:
sc create YY.SmsPlatform.RemoteDataCenter binPath= "E:\YY.SmsPlatform\YY.SmsPlatform.RemoteData ...
随机推荐
- wflag
http://stackoverflow.com/questions/41312622/how-to-echo-an-alert-in-php-a-string-some-confusion-with ...
- Windows与Linux共享文件夹互相访问
[原文] 首先安装并配置软件samba [html] view plain copy sudo yum install samba samba-client vim /etc/samba/smb.c ...
- forms6 builder安装之后设置注册表开发环境
- 捕获JS 错误日志
最近在做项目的过程中,发现很多JS报错没有引起重视,我就想想把JS错误捕获了,然后展示在我们一个平台上 具体实现代码: window.onerror = function(message, url, ...
- HDFS中高可用性HA的讲解
HDFS Using QJM HA使用的是分布式的日志管理方式 一:概述 1.背景 如果namenode出现问题,整个HDFS集群将不能使用. 是不是可以有两个namenode呢 一个为对外服务-&g ...
- PHP--yii中findOne转换成数组
$res = News::findOne($new_id)->toArray(); yii框架的多表联查:controller层: //news 与 news_theme 是多对一的关系$inf ...
- Koala编译less
下载地址:http://koala-app.com/index-zh.html 用Koala可以用来编译less,软件也是简单明了,平时开着其他软件编辑less,只要打开Koala,勾选“自动编译”后 ...
- 【转】Android中Application类用法
转自:http://www.cnblogs.com/renqingping/archive/2012/10/24/Application.html Application类 Application和A ...
- MVC强类型和弱类型的区别
1 强类型的处理 首先必须要有一个对象的实体类,UserINfo就是一个实体类,如下: public class UserInfo() { public int Id{set;get;} publi ...
- 面试&笔试常见题,你了解多少?
HTML:1. 什么是语义化的HTML?有何意义?为什么要做到语义化?(高频率考题)2. 行内元素和块元素分别有哪些?(高频率)3. 严格模式与混杂模式的区分?如何触发这两种模式?(高频率)4. ...