"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. MarkdownPad2 在 Windows10 下 预览无法显示

    Windows10下面一直报错,无法使用. 解决方法: 安装 Awesomium 1.6.6 SDK,如果还是有问题,请继续安装:Microsoft's DirectX End-User Runtim ...

  2. idea上查看本文件svn修改的历史版本

    如上图依次点击,得到下图,比较即可:

  3. 改造 Ace Admin 模板的 ace_tree 组件的 folderSelect 样式

    *注:我用的Ace Admin版本为1.3.4 Ace Admin 是一个轻量,功能丰富,HTML5.响应式.支持手机及平板电脑上浏览的优秀管理后台模板. 关于tree的使用,html文件夹下tree ...

  4. 集成学习之Boosting —— Gradient Boosting实现

    Gradient Boosting的一般算法流程 初始化: \(f_0(x) = \mathop{\arg\min}\limits_\gamma \sum\limits_{i=1}^N L(y_i, ...

  5. python的单元测试代码编写流程

    单元测试: 单元测试是对单独的代码块分别进行测试, 以确保它们的正确性, 单元测试主要还是由开发人员来做, 其余的集成测试和系统测试由专业的测试人员来做. python的单元测试代码编写主要记住以下几 ...

  6. Echart参数详解收藏

    最全: https://www.cnblogs.com/Kqingniao/p/5833419.html 柱形图: https://blog.csdn.net/qq_36330228/article/ ...

  7. Nginx 设置rewrite规则是遇到的一个{}大括号引发的报错问题

    一个群友提到: 用nginx image_filter模块裁图,用!拼宽高能够实现,现在想用参数传宽高总是报错,配置如下:   location ~ ^/images/.* {     if ( $q ...

  8. 《DSP using MATLAB》Problem 2.16

    先由脉冲响应序列h(n)得到差分方程系数,过程如下: 代码: %% ------------------------------------------------------------------ ...

  9. ringojs java jar 集成使用

    ringojs 可以方便进行java 代码的集成,我们可以把下载的jar包放到classpath,后者ringojs 的lib 目录 也可以进行代码编写 测试代码 集成了java 的一个hashid ...

  10. Kubernetes才是微服务和DevOps的桥梁

    一.从企业上云的三大架构看容器平台的三种视角 一切都从企业上云的三大架构开始. 如图所示,企业上的三大架构为IT架构,应用架构和数据架构,在不同的公司,不同的人,不同的角色,关注的重点不同. 对于大部 ...