Thursday, April 19, 2012

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.
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
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.
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
The above command would kill Google Chrome, the calculator and Microsoft Excel.

No comments:

Post a Comment