"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. UVA-1617 Laptop (贪心)

    题目大意:有n条长度为1的线段,n个区间,第i条线段在第i个区间中,问线段之间的最少间隙有几个. 题目分析:先对区间排序,先按右端点排,再按左端点排.有重叠的区间(仅有交点重叠也视为重叠)之间一定可以 ...

  2. 如果从码云上git clone项目

    1.本地找个文件夹右击选择 git base 2.输入地址 弹出一个窗口 需要输入用户名.密码(就是码云的登录名.密码) 3.完成

  3. (转载)Nginx/LVS/HAProxy三种主流负载均衡软件的对比

    原地址:http://www.ha97.com/5646.html PS:Nginx/LVS/HAProxy是目前使用最广泛的三种负载均衡软件,本人都在多个项目中实施过,参考了一些资料,结合自己的一些 ...

  4. L192 Virgin Galactic Completes Test of Spaceship to Carry Tourists

    Virgin Galactic says its spacecraft designed to launch tourists into space completed an important te ...

  5. mongodb配置数据库文件夹,创建服务

    配置步骤 1.新建data文件夹,并在data下创建db及log文件夹 2.在mongodb安装目录下新增mongod.cfg文件,配置如下 systemLog:    destination: fi ...

  6. ubuntu16 Intellij Idea Install&config

    1,下载idea二进制文件,有免费和不免费的. https://www.jetbrains.com/idea/download/#section=linux 2,解压下载文件. tar -xvzf . ...

  7. 《FDTD electromagnetic field using MATLAB》读书笔记之一阶、二阶偏导数差商近似

  8. Mac OS Alfred 2 tips

    From: http://www.uuair.cn/?p=64 写这个东西,我没敢叫指南之类,只能算是技巧,因为Alfred这个软件的强大,我还没研究明白,还有好多功能自己没搞懂,所以写一些我发现或者 ...

  9. Panabit Live CD使用说明

    为了方便更多的用户实际使用Panabit,省去安装FreeBSD和Panabit等步骤,自2007年9月,即Panabit V7.09起,Panabit网站发布Panabit标准版安装包时,同步发布相 ...

  10. 编译sass,遇到报错error style.scss (Line 3: Invalid GBK character "\xE5")

    今天学习sass,写了一行中文注释,结果却遇到了报错: cmd.exe /D /C call C:/Ruby23-x64/bin/scss.bat --no-cache --update style. ...