How to manage Windows services via command line

People are always looking for efficient ways to manage system tasks without leaving the terminal, even when using Windows. On Windows, services run in the background to keep the system and applications running smoothly. Instead of opening the Services Manager, many people prefer to manage Windows services through the command line. In today’s tutorial, we will explore these methods and see how you can manage Windows services right from the terminal.

1. Manage Windows service using sc.exe

sc.exe is a built-in command-line tool for managing Windows services. It allows you to configure, query, and control services directly from the terminal. With sc.exe, you can have complete control over Windows services without the need for the graphical Services Manager.

Check service status with sc

We can use the sc query serviceName command to check the status of a specific service. For example, we run the sc query MySQL80 command to retrieve detailed information about the MySQL80 service, including its status:

How to manage Windows services via command line
Check service status with sc

MySQL is not running on the machine at the moment.

Start a service with sc

To start a specific service using sc.exe, we can use the sc start ServiceName command . For example, we run sc start MySQL80 to start the MySQL80 service. To verify whether the service has started successfully, we can check the status of the service using the sc query MySQL80 command :

How to manage Windows services via command line

Stop a service with sc

You can stop a service to free up system resources. For example, the sc stop MySQL80 command stops MySQL, which can be verified with the sc query MySQL80 command :

How to manage Windows services via command line

Create a new service using sc

We can create a new service using the sc create command . This command requires specifying the service name, executable path, and startup type. For example, to create a new service called "mte" that will start automatically on boot, type:

sc create mte binPath= "C:\Users\HP\Desktop\Examples\Service.exe" start= auto
How to manage Windows services via command line

Update a service using sc

We can use the sc config command to configure an existing service. For example, to change the startup type to manual, run the command:

sc config serviceName start= demand
How to manage Windows services via command line

Delete service using sc

When the service is no longer needed, we can permanently remove it from Windows with the command:

sc delete srviceName
How to manage Windows services via command line

2. Manage Windows services using the Net command

The net command in Windows allows us to manage services from the command line. This command allows users to start, stop, pause, resume, and query services without using the graphical Services Manager.

Start and stop services using the net command

We can start or stop Windows services using the net start serviceName and net stop serviceName commands respectively:

How to manage Windows services via command line
Start or stop service with net command

Pause and resume service using net command

Some Windows services support pausing and continuing instead of stopping completely. In that case, we can use the net pause ServiceName and net continue ServiceName commands respectively:

How to manage Windows services via command line
Pause and resume net service

Check service status with net command

The net command itself does not provide a direct way to check the status of a specific service, but we can use it in conjunction with the findstr command to filter the results. For example, to check if a specified service is running, type:

net start | findstr "ServiceName"
How to manage Windows services via command line
Check service status with net command

If the specified service is running, the command returns the name of that service; otherwise, there is no output.

Manage remote services using the net command

We can use the net command to manage services on a remote computer by specifying the computer name. For example, the net start ServiceName /S RemotePC and net stop ServiceName /S RemotePC commands are used to start or stop services on a remote computer.

Sign up and earn $1000 a day ⋙

Leave a Comment

How to update graphics drivers in Windows 10 and 11

How to update graphics drivers in Windows 10 and 11

Updating your graphics card driver to the latest version can help fix issues with screen resolution, games, and your computer's overall graphics performance.

Learn about the nature of UAC in Windows and how to use this setting to control Windows user permissions

Learn about the nature of UAC in Windows and how to use this setting to control Windows user permissions

In the following article, Quantrimang.com will go into the specific details of what UAC is, how UAC works, and the benefits of enabling this feature in any version of Windows.

Useful Tips to Never Run Out of Windows Storage Space

Useful Tips to Never Run Out of Windows Storage Space

Constant low storage notifications can drive you crazy, so start implementing smart habits to make sure you never run out of storage!

Enable GodMode on Windows 10, 8 and 7

Enable GodMode on Windows 10, 8 and 7

GodeMode is called Shortcut Windows Master Control Panel. GodMode (or God Mode) is a control panel, allowing you to set up and access everything on your Windows operating system.

How to turn off location request notifications on Windows 11

How to turn off location request notifications on Windows 11

Starting with Windows 11 build 25977, Microsoft has added an option to turn off location request notifications to help you manage which apps have location access.

Windows 11 updates silently create a mysterious folder on the C drive

Windows 11 updates silently create a mysterious folder on the C drive

The April security updates for Windows 11 silently created a new empty folder on the C drive.

How to delete the Learn More About This Picture icon Windows 11

How to delete the Learn More About This Picture icon Windows 11

The Spotlight wallpaper on the Windows 11 desktop and lock screen has an annoying “Learn More About This Picture” icon. Here is a guide to remove the “Learn More About This Picture” Windows 11 icon.

9 ways to open Apps & Features tool on Windows 11

9 ways to open Apps & Features tool on Windows 11

The Apps & Features control panel is the settings equivalent to the Programs and Features tool from the Control Panel.

How to display Libraries folder on Windows 11

How to display Libraries folder on Windows 11

The Libraries folder in Windows 11 is hidden in the File Explorer interface, but you can easily show it again with just a few taps.

How to fix high memory usage issue on Microsoft Edge

How to fix high memory usage issue on Microsoft Edge

Are you getting a High Memory Usage Detected warning while browsing on Microsoft Edge? It means that some browser processes are using too much memory (RAM).

How to set up speech recognition in Windows

How to set up speech recognition in Windows

Follow these steps to set up speech recognition on your Windows laptop or PC.

Restore hidden folders in Windows when infected with virus

Restore hidden folders in Windows when infected with virus

In many cases, it is usually due to virus attacks that the hidden folders of the system cannot be displayed even after activating the “Show hidden files and folders” option in Folder Options. Some of the following methods will help to handle this problem.

3 ways to turn off Windows 10 firewall

3 ways to turn off Windows 10 firewall

Sometimes you still need to turn off the firewall to perform certain functions. The 3 ways to turn off the Win 10 firewall below will help you in such situations.

How to add Shutdown desktop shortcut in Windows 11

How to add Shutdown desktop shortcut in Windows 11

If you're looking for a quicker method, here's how to add a dedicated shutdown shortcut to your Windows 11 desktop or taskbar.

How to add JPEG XL support in Windows 11

How to add JPEG XL support in Windows 11

Windows 11 doesn't support the JPEG X image format by default, but you can install an add-on that does. Here's how to add JPEG XL support in Windows 11.