How To Kill Process In Windows?

When an application or program starts a process is created in order to execute the application and programs. The process also contains program code, system resources, a process ID for identification, etc. Ideally, the process is stopped when the application is closed and exited properly. But in some cases, we may need to kill the process explicitly by using different tools and methods like Task Bar, taskkill command, Stop-Process PowerShell command. In this tutorial, we will learn how to find the process and kill it in different ways.

Kill Process via Task Manager

The Task Manager is a GUI tool used to display, monitor and manage processes. Task Manager can be also used to kill processes. It can be opened in different ways where using the Task Bar is the easiest way. Just right-click to the task bar

There we will see the task manager main screen. If there is an empty screen with the “More details” button below just lick to this button to the currently running processes. From the list select the process or application you want to kill and right-click on it. you will see a context menu that contains the “End task” just click this this will end or kill the task with a related process.

alternativelythe Details tab can be used to kill process. The details tab list all process event the same task has multiple process all of its processes are listed in this Details tab. Killing process is the same where right click to the process you want to kill and then select “End task” like below.

Kill Process via Task Manager Details Tab

Kill Process with taskkill Command

Windows MS-DOS or command prompt provides the taskkill command which is used to kill the process. Every process executes with different privileges where some are Administrator processes and some are current user process. Administrator processes require Administrator privileges where the MS-DOS should be opened with Administrator privileges.

READ  PowerShell Select-Object Tutorial

First we will list currently running processes with the “tasklist” command.

tasklist

The output is like below here every running process is listed with the following information. The process list is sorted according to the PID and generally the user processes get higher PID and listed at the end of the process list.

  • Image Name is the process name or executable name.
  • PID is the processes ID which identifies the process with a unique number. We will use PID in order to kill process.
  • Session Name
  • Session
  • Mem Usage is the memory usage of the give process.
List Processes with tasklist Command

Now we can kill the process with its PID. We will use the taskkill command and provides the process ID with the /PID option. Also, we will use the /F option in order to kill the given process forcibly.

taskkill /F /PID 3020

If the process is killed succesfully the following message will be printed as output.

SUCCESS: The process with PID 3020 has been terminated.

Aleternatively we can kill a process with its name or some part of name. The exact process name or executable name shouldbe provided. If there are mulitiple processes with the same executable name all of them will be killed. In the following example we will kill the “firefox.exe”.

taskkill /F /IM "firefox.exe"

The output is like below. We can see that there is a multiple-line output where each running “firefox.exe” is terminated successfully.

SUCCESS: The process "firefox.exe" with PID 7064 has been terminated.
SUCCESS: The process "firefox.exe" with PID 1100 has been terminated.
SUCCESS: The process "firefox.exe" with PID 2180 has been terminated.
SUCCESS: The process "firefox.exe" with PID 1624 has been terminated.
SUCCESS: The process "firefox.exe" with PID 6488 has been terminated.

Kill Process with Stop-Process PowerShell Command

PowerShell is the next-generation command-line interface and scripting language provided by Microsoft Windows. The Stop-Process command can be used to kill or stop specified processes. But before killing processes we will list processes with their process ID.

Get-Process
List Processes with Get-Process

The Get-Process command output provides followin information about listed processes.

  • Handles
  • NPM
  • PM
  • WS
  • CPU
  • Id
  • SI
  • ProcessName
READ  What Is Windows Command Prompt?

We can use the process ID in order to specify process to kill with the Stop-Process command. The process id prvided with the -ID attribute like below. Also the -Force attribute can be useful to force killing specified process.

Stop-Process -ID 1892 -Force

Alternatively, the process name can be specified to kill. the -Name attribute used to specify the process name. This will kill even multiple processes which name is “firefox”.

Stop-Process -Name "firefox" -Force

Leave a Comment