Windows Tutorials - Herong's Tutorial Examples - Version 5.60, by Dr. Herong Yang

"sc.exe create/delete" - Create or Delete Services

This section provides a tutorial example on how to create and delete a program service with 'sc.exe' Service Controller command tool.

"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               : 10  WIN32_OWN_PROCESS
   STATE              : 2  START_PENDING
                      (NOT_STOPPABLE,NOT_PAUSABLE,IGNORES_SHUTDOWN)
   WIN32_EXIT_CODE    : 0  (0x0)
   SERVICE_EXIT_CODE  : 0  (0x0)
   CHECKPOINT         : 0x2
   WAIT_HINT          : 0x7530
   PID                : 2552
   FLAGS              :


C:\herong>sc.exe query ApacheService

SERVICE_NAME: ApacheService
   TYPE               : 10  WIN32_OWN_PROCESS
   STATE              : 4  RUNNING
                      (STOPPABLE,NOT_PAUSABLE,IGNORES_SHUTDOWN)
   WIN32_EXIT_CODE    : 0  (0x0)
   SERVICE_EXIT_CODE  : 0  (0x0)
   CHECKPOINT         : 0x0
   WAIT_HINT          : 0x0


C:\herong>sc.exe stop ApacheService

SERVICE_NAME: ApacheService
   TYPE               : 10  WIN32_OWN_PROCESS
   STATE              : 3  STOP_PENDING
                      (NOT_STOPPABLE,NOT_PAUSABLE,IGNORES_SHUTDOWN)
   WIN32_EXIT_CODE    : 0  (0x0)
   SERVICE_EXIT_CODE  : 0  (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 1060:
The specified service does not exist as an installed service.

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

Table of Contents

 About This Windows Tutorial Book

 Introduction to Microsoft Windows

 Introduction to Windows Explorer

 Introduction to Internet Explorer

 "Paint" Program and Computer Graphics

 GIMP - GNU Image Manipulation Program

 JPEG Image File Format Quality and Size

 GIF Image File Format and Transparent Background

 "WinZip" - ZIP File Compression Tool

 "WinRAR" - RAR and ZIP File Compression Tool

 FTP Server, Client and Commands

 "FileZilla" - Free FTP Client and Server

 Web Server Log Files and Analysis Tool - "Analog"

 Spyware Adware Detection and Removal

 IE Addon Program Listing and Removal

 Vundo (VirtuMonde/VirtuMundo) - vtsts.dll Removal

 Trojan and Malware "Puper" Description and Removal

 VSToolbar (VSAdd-in.dll) - Description and Removal

 Spybot - Spyware Blocker, Detection and Removal

 Setting Up and Using Crossover Cable Network

 Home Network Gateway - DSL Modem/Wireless Router

 Windows Task Manager - The System Performance Tool

 "tasklist" Command Line Tool to List Process Information

 "msconfig" - System Configuration Tool

Configuring and Managing System Services

 What Are Windows Services and Related Programs?

 The Life Cycle of A Service - "Google Updater"

 Installed Services in System Registry

 "sc.exe" - A Command Line Tool to Manage Services

 "sc.exe query type= driver" - All Device Driver Services

 "sc.exe query type= service" - All Application Program Services

 "sc.exe query/start/stop" - Query, Start or Stop Services

"sc.exe create/delete" - Create or Delete Services

 "services.msc" - Program Services Console

 "services.msc" - Stoping and Starting Services

 "services.msc" - Disabling Services

 "Task Manger" - Ending a Service Process

 Windows Registry Key and Value Management Tools

 Startup Programs Removal for Better System Performance

 Winsock - Windows Sockets API

 Java on Windows

 Glossary of Terms

 Outdated Tutorials

 References

 PDF Printing Version

"sc.exe create/delete" - Create or Delete Services - Updated in 2014, by Dr. Herong Yang