How to Stop a Running Service or a Program from Command Prompt or PowerShell.

Last updated on October 4th, 2020

If you want to learn how to stop a running service or a program from command prompt or from the Windows PowerShell, then continue reading this tutorial. The usual way to terminate a running process in Windows, is to open the Task Manager, to right click on the process and to select 'End Task' or "End process tree". Additionally, if you want to Stop a service, you have to navigate to services and to select the "Stop" option, after right-clicking on the service.

Advertisements

However, another useful way to terminate a running service or program, is to use the Command Line or the PowerShell, especially in cases where you cannot terminate the process using Task Manager.

How to Stop a Service or Program from Command Prompt or PowerShell.

How to Terminate any Running Process (Program or Service) from Command prompt or PowerShell.*

* Note: Keep in mind, that critical Windows services cannot be stopped in any way.

Step 1. Find the Name or the PID of the Running Process.

In order to stop an application or service from the command prompt or from the PowerShell, you need to know the Process Name or the Process Identifier (PID)*.

* Note: The Process Identifier (PID), is a unique number that identifies each of the running processes on the Operating System.

To find the Name or the Name or the PID of a process, use one of the following ways:

Option 1. Find the Process Name & PID from Task Manager.

The first and most easy way to find the name and the PID of a process in Windows, is from the Details tab in Task Manager. Additionally, if you want to find out the Name & PID of a service, select the Services tab.

Find PID from Task Manager

Option 2. Find the Process Name & PID from Command Prompt or PowerShell.

1. To view the Name and the PID of all the running processes, type the following command (and press Enter), either in Command Prompt or in PowerShell: *

  • tasklist

Taskkill

2. Now notice the PID the process that you want to stop and continue to step 2. *

Advertisements

* TIPS:
1. To view a list of all the PIDs of a running program (process), give this command:

  • tasklist /fi "imagename eq ProcessName.exe"

e.g. to view all the PIDs of the "Chrome.exe" process, type:

  • tasklist /fi "imagename eq chrome.exe"

image

2. To view the PID of a specific service type:

  • sc queryex ServiceName

e.g. to view all the PID of the "BITS" service process, type:

  • sc queryex bits

image

Step 2. Terminate a Process from the Command Prompt or the PowerShell.

After finding the Name or the PID of the process/service that you want to stop, proceed to stop it by following the instructions below:

Part 1. How to Kill a Process from Command Prompt.

To terminate a process from command prompt, you can use either its name or its PID.

A. To terminate a running process by using its PID from Command Prompt:

1. Open Command Prompt as Administrator.
2. Type the following command and press Enter:*

  • taskkill /F /PID ProcessPID

* Note: Where ProcessPID = the PID of the process that you want to stop. e.g.: If you want to terminate the "notepad.exe" process with PID 1908, type:

  • taskkill /F /PID 1908

terminate process by PID

B. To force close all instances of a running service or application, by using its name:

1. Open Command Prompt as Administrator.
2. Type the following command and press Enter:*

  • TASKKILL /F /IM ProcessName /T

* Note: Where ProcessName = The name of the application that you want to stop as listed in the "Image Name" column. e.g.: If you want to terminate all the instances of the "Chrome.exe" application, type:

  • TASKKILL /F /IM chrome.exe /T

Terminate process by Process Name

Part 2. How to Kill a Process from PowerShell.

To stop a process from PowerShell, you can use either its name or its PID.

A. To force stop a running process of a service or application, by using the PID:

1. Open PowerShell as Administrator.
2.
Type the following command and press Enter: *

  • kill -id ProcessPID

* Note: Where ProcessPID = the PID of the process that you want to stop. e.g.: If you want to terminate the "notepad.exe" process with PID 396, type:

  • kill -id 396

Kill Process PID

B. To stop a running process or service, by using its name from PowerShell:

  • Stop-Process -Name "ProcessName"

* Note: Where ProcessName = The name of the application that you want to stop as listed in the "Image Name" column without the ".exe extension". e.g.: If you want to terminate all the instances of the "Chrome.exe" application, type:

  • Stop-Process -Name "chrome"

Stop Process

That's it! Let me know if this guide has helped you by leaving your comment about your experience. Please like and share this guide to help others.

If this article was useful for you, please consider supporting us by making a donation. Even $1 can a make a huge difference for us in our effort to continue to help others while keeping this site free: