"sc.exe" can also be used to create and delete services. If you want to create a new service, you can use the "create" commanded offered by the sc.exe tool. Before running this command, you need to prepre the following minimum information:

  • Service Name: A single word to name the new service.
  • Binary Path: The path name where the executable program for new service is located.
  • Dispaly Name: A short name for the new service.

Here is a tutorial example showing you how to create a service to run Apache Web server:

C:\herong>sc.exe create ApacheService
binPath= "C:\local\apache\bin\httpd.exe -k runservice"
DisplayName= "Apache Server" [SC] CreateService SUCCESS C:\herong>sc.exe start ApacheService SERVICE_NAME: ApacheService
TYPE : WIN32_OWN_PROCESS
STATE : START_PENDING
(NOT_STOPPABLE,NOT_PAUSABLE,IGNORES_SHUTDOWN)
WIN32_EXIT_CODE : (0x0)
SERVICE_EXIT_CODE : (0x0)
CHECKPOINT : 0x2
WAIT_HINT : 0x7530
PID :
FLAGS : C:\herong>sc.exe query ApacheService SERVICE_NAME: ApacheService
TYPE : WIN32_OWN_PROCESS
STATE : RUNNING
(STOPPABLE,NOT_PAUSABLE,IGNORES_SHUTDOWN)
WIN32_EXIT_CODE : (0x0)
SERVICE_EXIT_CODE : (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x0 C:\herong>sc.exe stop ApacheService SERVICE_NAME: ApacheService
TYPE : WIN32_OWN_PROCESS
STATE : STOP_PENDING
(NOT_STOPPABLE,NOT_PAUSABLE,IGNORES_SHUTDOWN)
WIN32_EXIT_CODE : (0x0)
SERVICE_EXIT_CODE : (0x0)
CHECKPOINT : 0x4
WAIT_HINT : 0x7530 C:\herong>sc.exe delete ApacheService [SC] DeleteService SUCCESS C:\herong>sc.exe query ApacheService [SC] EnumQueryServicesStatus:OpenService FAILED :
The specified service does not exist as an installed service.

Note that I deleted the service at the end of the tutorial.

"sc.exe create/delete" - Create or Delete Services的更多相关文章

  1. Zookeeper常用操作命令create,set,delete

    一.zk特性的session的基本原理 1.客户端与服务端之间的连接存在会话 2.每个会话都可以设置一个超时时间 3.心跳结束,session则过期 4.session过期,则临时节点znode会被抛 ...

  2. 如何删除windows服务(sc.exe删除和注册表删除两种方法)

    一.什么是Windows服务 Windows服务也称为Windows Service,它是Windows操作系统和Windows网络的基础,属于系统核心的一部分,它支持着整个Windows的各种操作. ...

  3. sc.exe管理系统服务

    sc.exe管理系统服务 下面介绍SC,SC QC,and SC QUERY sc.exe create HomerSatelliteDesktopGC binPath= "D:XXXXXX ...

  4. sc.exe用法详解

    sc.exe是帮助开发 WindowsNT 服务的工具,这里我来说说如何使用好sc.exe. 我们打开命令提示符(以管理员身份运行): 输入sc delete ServiceName(服务名)  即可 ...

  5. 浅谈 C++ 中的 new/delete 和 new[]/delete[]

    在 C++ 中,你也许经常使用 new 和 delete 来动态申请和释放内存,但你可曾想过以下问题呢? new 和 delete 是函数吗? new [] 和 delete [] 又是什么?什么时候 ...

  6. problem during schema create,statement create sequence act_evt_log_seq

    今天在调试程序的时候出现"problem during schema create,statement create sequence act_evt_log_seq"这个错误,跟 ...

  7. 【转】浅谈 C++ 中的 new/delete 和 new[]/delete[]

    在 C++ 中,你也许经常使用 new 和 delete 来动态申请和释放内存,但你可曾想过以下问题呢? new 和 delete 是函数吗? new [] 和 delete [] 又是什么?什么时候 ...

  8. [转] 浅谈 C++ 中的 new/delete 和 new[]/delete[]

    转:http://www.cnblogs.com/hazir/p/new_and_delete.html 在 C++ 中,你也许经常使用 new 和 delete 来动态申请和释放内存,但你可曾想过以 ...

  9. PHP MySQL Delete From 之 Delete

    删除数据库中的数据 DELETE FROM 语句用于从数据库表中删除记录. 语法 DELETE FROM table_name WHERE column_name = some_value 注释:SQ ...

随机推荐

  1. 12.2 Web窗体--代码片段详解

    第12章  使用Web窗体  ※ 除常规HTML元素之外,Web窗体文件还包含另外3种内容:代码片段.可编程HTML元素和控件 ※ 代码隐藏类只应包含特定于单个Web窗体的代码.如果存在多个Web窗体 ...

  2. SGU 156 Strange Graph 欧拉回路,思路,汉密尔顿回路 难度:3

    http://acm.sgu.ru/problem.php?contest=0&problem=156 这道题有两种点 1. 度数>2 在团中的点,一定连接一个度数为2的点 2. 度数等 ...

  3. sgu 147. Black-white king 思路 坑 难度:1

    147. Black-white king time limit per test: 0.25 sec.memory limit per test: 4096 KB input: standard i ...

  4. RabbitMQ三种Exchange模式

    RabbitMQ中,所有生产者提交的消息都由Exchange来接受,然后Exchange按照特定的策略转发到Queue进行存储 RabbitMQ提供了四种Exchange:fanout,direct, ...

  5. Web开发框架之权限管理系统

    Web开发框架之权限管理系统 记得我在很早之前,开始介绍我的Winform开发框架和我的WCF开发框架之初,我曾经给出下面的视图,介绍我整理的一个框架体系,其中包含有WInform开发框架以及我的We ...

  6. jQuery的无new创建方法

    一般我们去写一个框架,会采用什么样的设计呢?比如设计一个jQuery框架,一般我们会创建一个函数对象 function jQuery(params){ //构造函数 }jQuery.prototype ...

  7. WebGL编程指南案例解析之绘制四边形

    //案例4,绘制矩形,和三角形类似,但是注意因为一个矩形有4个顶点,按照两个三角形绘制矩形的话,顶点顺序要注意 var vShader = ` attribute vec4 a_Position; v ...

  8. 报表生成poi----java操作java对象生成execl表单

    1.Apache POI简介 Apache POI是Apache软件基金会的开放源码函式库,POI提供API给Java程式对Microsoft Office格式档案读和写的功能. .NET的开发人员则 ...

  9. Linux下sniffer实现(转)

    转发网址:https://blog.csdn.net/eqiang8271/article/details/8489769 //Example 1. #include <stdio.h> ...

  10. WiFi密码破解详细图文教程

    每天都能看到有不少网友在回复论坛之前发布的一篇破解WiFi密码的帖子,并伴随各种疑问.今天流云就为大家准备一篇实战型的文章吧,详细图文从思维CDlinux U盘启动到中文设置,如何进行路由SSID扫描 ...