• ARTICLES
SEARCH

How-To Geek

Application Not Responding? Here’s How to Kill Processes with PowerShell

pshelltwo

Ever have one of those days where programs just aren’t cooperating?  You try terminating a program, but it doesn’t respond?   PowerShell can give you some extra fire power on those days.

How Do I Stop A Program In PowerShell?

1.  The long command name stop-process can be shortened to kill.

image

2.  If you know the numeric process that you’re wanting to stop, you can enter it.  However, like most Window’s users, we know the name of the program we want to stop, so entering the name would be more convenient.  The code below shows the next step (entering –processname to specify to PowerShell that it is going to stop a process with a name of what we want).

kill -processname

3.  Next, we need to know the name of the process we want to stop.  If we want to stop Chrome, for instance, we would enter:

kill -processname chrome

image

If we hit enter (and Chrome was open), the program would end.  Important note: some processes aren’t named what you think.  You can locate the name of the processes by starting task manager and reviewing the processes.

image

Notice that Google Chrome is listed as chrome, while the calculator is listed as calc.  In order to stop the calculator we would type:

kill -processname calc

4.  If we want to stop multiple process such as Chrome, calculator and Excel, we would separate the processes by a comma:

kill -processname chrome, calc, excel

image

The above command would kill Google Chrome, the calculator and Microsoft Excel.

Tim Smith is a .NET developer and database administrator for SQLwatchmen.

  • Published 04/19/12

Comments (24)

  1. Garrett

    1. Win+R
    2. taskkill /f /im *process_name*.exe
    3. *profit*

  2. brunlea

    thanks geek…very useful tut, i didnt know about this and i had many of these annoying app frozen many times i end up turning power off in order to kill it.

  3. r

    ..or

    1.Ctl + Shift + Esc
    2. *process_name*
    3. End process

  4. brunlea

    another thing geek and i had this many times. the taskbar get freeze up and then what you do?.

  5. Sparks

    Another Powershell way

    ps processname | kill

  6. r

    @brunlea

    1. Ctl + Shift + Esc > kill explorer.exe (process) then restart it in Application (tab) “new task”.

    if nothing then 2. CTRL+ALT+delete ( you may have to wait a bit) then restart system.

    * If this is a frequent problem then it’s likely related to video. update your drivers.

  7. Dwight Hoyes

    Process Explorer from Mark Russinovich (MS TechNet) is a better alternative.

  8. Jeffery Hicks

    Stop-Process also supports -WhatIf so you can get a sanity check before you do the deed.

    stop-process -name chrome -whatif

    or using aliases and the pipeline:

    ps chrome | kill -whatif

  9. twitter:@ihunger

    adding on Jeffery’s tip, you can use wild cards.

    PS H:\> ps ch* | kill -WhatIf
    What if: Performing operation “Stop-Process” on Target “chrome (1264)”.
    What if: Performing operation “Stop-Process” on Target “chrome (3804)”.
    What if: Performing operation “Stop-Process” on Target “chrome (4028)”.
    What if: Performing operation “Stop-Process” on Target “chrome (4044)”.
    What if: Performing operation “Stop-Process” on Target “chrome (4060)”.

    PS H:\> ps *ch* | kill -WhatIf
    What if: Performing operation “Stop-Process” on Target “ccSvcHst (1340)”.
    What if: Performing operation “Stop-Process” on Target “chrome (1264)”.
    What if: Performing operation “Stop-Process” on Target “chrome (3804)”.
    What if: Performing operation “Stop-Process” on Target “chrome (4028)”.
    What if: Performing operation “Stop-Process” on Target “chrome (4044)”.
    What if: Performing operation “Stop-Process” on Target “chrome (4060)”.
    What if: Performing operation “Stop-Process” on Target “SearchIndexer (37
    What if: Performing operation “Stop-Process” on Target “svchost (324)”.
    What if: Performing operation “Stop-Process” on Target “svchost (448)”.
    What if: Performing operation “Stop-Process” on Target “svchost (764)”.
    What if: Performing operation “Stop-Process” on Target “svchost (868)”.
    What if: Performing operation “Stop-Process” on Target “svchost (1008)”.
    What if: Performing operation “Stop-Process” on Target “svchost (1056)”.
    What if: Performing operation “Stop-Process” on Target “svchost (1272)”.
    What if: Performing operation “Stop-Process” on Target “svchost (1528)”.
    What if: Performing operation “Stop-Process” on Target “svchost (1744)”.
    What if: Performing operation “Stop-Process” on Target “svchost (2800)”.
    What if: Performing operation “Stop-Process” on Target “TscHelp (296)”.

  10. dreamer

    Am I missing something here, coz PowerShell seems unnecessary really. Like if you want to stop the calc process in above example, just right-click it in task manager and select End Process.
    As for the taskbar/ explorer issues, I just click the start orb > CTRL + SHIFT + Mouse-Right-click anywhere near the “power” (ShutDown) button > select Exit Explorer.
    Then to Restart Explorer hit CTRL+SHIFT+ESC to open task manager > click file > new task > run, and then type explorer. EASY, but then I almost never have problems on win 7 ultimate.
    But please keep the tips coming. The website how-to has been really useful; and I’m helping two friends get started as well. HTG rocks!

  11. Sherman Kaplan

    Why not simply use Task Manager. Under the process tab, simply click on the one you want killed, right click the mouse, and hit delete…no big deal. btw, I use a program called AlacrityPC, by Ken Salter, to stop unwanted processes, and then restart them when I am finished with memory intensive gaming.

    http://alacritypc.kensalter.com/

    Sherm

  12. Baggins

    @dreamer: This could be really useful in scripts if you have a buggy program that frequently fails to close properly. Or, say you have an old game that won’t run correctly if Explorer is also running (e.g. the original Diablo under Windows 7 x64)- with this, you could potentially create a script that automatically kills explorer, starts the game and restarts Explorer when you’re done playing.

    Like most of the Geek’s tips, you might not see the point immediately, but if you’re the person who *does* need the tip, the information is invaluable.

  13. Ved Prakash

    I think when we are using powershell, then we should use it completely.
    It make no sense to check the process name from task manager and killing process from powershell.
    So we can get the processes from powershell using

    get-process
    In list we can see the process names and id as well
    the using kill or stop-process , process can be killed.

  14. dreamer

    @Baggins I hadn’t considered that. Duly noted. Thanks.

  15. dcastellanos

    Where is the link to download it? Or I’m too dummy or it doesn’t exist.

  16. Check Six

    @dcastellanos

    In Win 7 Ultimate it’s located here.

    C:\WINDOWS\system32\WindowsPowerShell\v1.0

    I’m not sure about other systems but to find it just go to Start Menu and in the Search Programs And Files window, type “PowerShell” without the quotation marks.

    You will get a list above, right Click on the “Windows Powershell” item in the list and choose “Open file location”.

  17. Tim Smith

    For the record, there are many ways to stop a program in Windows. If it responds immediately through task manager, and you prefer that route, take it. PowerShell provides another tool to do so. This PowerShell series introduces this tool kit for Windows users. Some will enjoy it. Some won’t see the point. Some will play with it and take what they like out of it.

    dcastellanos – in Windows 7 you can find PowerShell like Power Six mentions or in the accessories directory in the Start menu under the folder PowerShell. The version I show above is PowerShell ISE, but you can also run the same script on PowerShell (has a DOS-feel to it).

  18. Enric

    Hey cool stuff!
    Maybe not the most practical way of stopping a command in case of extreme necessity. But you need to know how to do it from the PShell. Say for instance that you are working with the PShell on a script and then you need to stop a process… it’s way handier to use kill than to do the 3-finger greeting, fire up the taskman and stop the process from there.

    OR you may be on a remote desktop and forgot to enable the options that allow you to use the taskman (well, you can still open Run and type it in).

    OR you are writing a script and need to ensure that a process is killed before starting an operation.

    THX HTG for sharing!

  19. Bob

    Resource Monitor, resmon.exe, allows you to suspend processes. It also graphs CPU, memory, disk and internet usage much more in depth than Task Manager.

  20. SSD

    I went to command prompt and typed
    kill -processname calc and hit enter
    response was
    “kill” is not recognized as internal or external command, operable program or batch file.
    hence it did not work

  21. Sebastien

    Ensure you’re in powershell console (Key combinaison : Windows + R and type powershell in the windows) and try again

  22. Byron

    Surprised that no one mentioned Process Explorer (http://technet.microsoft.com/en-us/sysinternals/bb896653). Bring it up, find process in list, select ‘kill process’ or ‘kill process tree’, violá! You’re done.

  23. Rob

    I believe many of you don’t get it..Yes you can use task manager and terminate programs or processes but the point Geek is trying to make here is that Powershell is MORE powerful the your simply task manager. Have you had those days when a computer is not responding and you end task a program like a hundred times and it just won’t close or kill a specific processe via task manager and it just does not want to shutdown? That is the point of this article, Powershell will go behond startmanager and powerfully will kill any programs or processes that will usually ignore task manager.

  24. BananaBoat

    Is it possible to stop a huge process rather than Kill it? i.e. I don’t want to finish the process, just want to
    “Pause” it so that I can start it later.

Get Free Articles in Your Inbox!

Join 134,000 newsletter readers

Email:

Go check your email!