<p>Occasionally a program on a Windows machine goes crazy and just hangs.  So I'll call up the task manager and hit the "End Process" button for it.  However, this doesn't always work; if I try it enough times then it'll usually die eventually, but I'd really like to be able to just kill it immediately.  On Linux I could just <code>kill -9</code> to guarantee that a process will die.</p>

<p>This also could be used for writing batch scripts and writing batch scripts is programming.</p>

<p><strong>Is there some</strong> program or <strong>command that comes with Windows that will always kill a process?</strong>  A free third-party app would be fine, although I'd prefer to be able to do this on machines I sit down at for the first time.</p>

[{'answer_id': 49990, 'author': 'JosephStyons', 'author_id': 672, 'author_profile': 'https://Stackoverflow.com/users/672', 'pm_score': 8, 'selected': False, 'text': '<pre><code>taskkill /im myprocess.exe /f\n</code></pre>\n\n<p>The "/f" is for "force".\nIf you know the PID, then you can specify that, as in:</p>\n\n<pre><code>taskkill /pid 1234 /f\n</code></pre>\n\n<p>Lots of other options are possible, just type taskkill /? for all of them.  The "/t" option kills a process and any child processes; that may be useful to you.</p>\n'}, {'answer_id': 49995, 'author': 'Iain Holder', 'author_id': 1122, 'author_profile': 'https://Stackoverflow.com/users/1122', 'pm_score': 5, 'selected': False, 'text': '<p>Get process explorer from sysinternals (now Microsoft)</p>\n\n<p><a href="http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx" rel="nofollow noreferrer">Process Explorer - Windows Sysinternals | Microsoft Docs</a></p>\n'}, {'answer_id': 50011, 'author': 'pilif', 'author_id': 5083, 'author_profile': 'https://Stackoverflow.com/users/5083', 'pm_score': 9, 'selected': True, 'text': '<p>"End Process" on the Processes-Tab calls <code>TerminateProcess</code> which is the most ultimate way Windows knows to kill a process.</p>\n\n<p>If it doesn\'t go away, it\'s currently locked waiting on some kernel resource (probably a buggy driver) and there is nothing (short of a reboot) you could do to make the process go away.</p>\n\n<p>Have a look at this blog-entry from wayback when: <a href="http://blogs.technet.com/markrussinovich/archive/2005/08/17/unkillable-processes.aspx" rel="noreferrer">http://blogs.technet.com/markrussinovich/archive/2005/08/17/unkillable-processes.aspx</a></p>\n\n<p>Unix based systems like Linux also have that problem where processes could survive a <code>kill -9</code> if they are in what\'s known as "Uninterruptible sleep" (shown by top and ps as state <code>D</code>) at which point the processes sleep so well that they can\'t process incoming signals (which is what <code>kill</code> does - sending signals).</p>\n\n<p>Normally, Uninterruptible sleep should not last long, but as under Windows, broken drivers or broken userpace programs (<code>vfork</code> without <code>exec</code>) can end up sleeping in <code>D</code> forever.</p>\n'}, {'answer_id': 50040, 'author': 'Rob Walker', 'author_id': 3631, 'author_profile': 'https://Stackoverflow.com/users/3631', 'pm_score': 4, 'selected': False, 'text': '<p>One trick that works well is to attach a debugger and then quit the debugger.</p>\n\n<p>On XP or Windows 2003 you can do this using ntsd that ships out of the box:</p>\n\n<pre><code>ntsd -pn myapp.exe\n</code></pre>\n\n<p>ntsd will open up a new window.  Just type \'q\' in the window to quit the debugger and take out the process.</p>\n\n<p>I\'ve known this to work even when task manager doesn\'t seem able to kill a process.</p>\n\n<p>Unfortunately ntsd was removed from Vista and you have to install the (free) <a href="http://www.microsoft.com/whdc/DevTools/Debugging/default.mspx" rel="noreferrer">debbugging tools for windows</a> to get a suitable debugger.</p>\n'}, {'answer_id': 8484538, 'author': 'diyism', 'author_id': 264181, 'author_profile': 'https://Stackoverflow.com/users/264181', 'pm_score': 0, 'selected': False, 'text': '<p>When ntsd access is denied, try:</p>\n\n<p>ZeroWave was designed to be a simple tool that will provide a multilevel termination of any kind of process.</p>\n\n<p>ZeroWave is also a easy-to-use program due to its simple installation and its very friendly graphical interface.</p>\n\n<p>ZeroWave has three termination modes and with the "INSANE" mode can terminate any kind of process that can run on Windows.</p>\n\n<p>It seems that ZeroWave can\'t kill avp.exe</p>\n'}, {'answer_id': 13894135, 'author': 'David Ruark', 'author_id': 1906581, 'author_profile': 'https://Stackoverflow.com/users/1906581', 'pm_score': 3, 'selected': False, 'text': '<p>setup an AT command to run task manager or process explorer as SYSTEM.</p>\n\n<pre><code>AT 12:34 /interactive "C:/procexp.exe"\n</code></pre>\n\n<p>If process explorer was in your root C drive then this would open it as SYSTEM and you could kill any process without getting any access denied errors.  Set this for like a minute in the future, then it will pop up for you.</p>\n'}, {'answer_id': 23441528, 'author': 'Dhruv Chandhok', 'author_id': 2656347, 'author_profile': 'https://Stackoverflow.com/users/2656347', 'pm_score': 5, 'selected': False, 'text': '<p>JosepStyons is right. Open cmd.exe and run</p>\n\n<pre><code>taskkill /im processname.exe /f\n</code></pre>\n\n<p>If there is an error saying,</p>\n\n<blockquote>\n  <p>ERROR: The process "process.exe" with PID 1234 could not be\n  terminated.\n      Reason: Access is denied.</p>\n</blockquote>\n\n<p>then try running cmd.exe as administrator.</p>\n'}, {'answer_id': 24095252, 'author': 'user541686', 'author_id': 541686, 'author_profile': 'https://Stackoverflow.com/users/541686', 'pm_score': 5, 'selected': False, 'text': '<p><a href="http://processhacker.sourceforge.net/" rel="noreferrer"><em>Process Hacker</em></a> has numerous ways of killing a process.</p>\n\n<p><img src="https://i.stack.imgur.com/ByAnj.png" alt=""></p>\n\n<p>(Right-click the process, then go to Miscellaneous->Terminator.)</p>\n'}, {'answer_id': 54930322, 'author': 'RmccurdyDOTcom', 'author_id': 4776140, 'author_profile': 'https://Stackoverflow.com/users/4776140', 'pm_score': 0, 'selected': False, 'text': '<p>FYI you can sometimes use SYSTEM or Trustedinstaller to kill tasks ;)</p>\n\n<p>google quickkill_3_0.bat</p>\n\n<pre><code>sc config TrustedInstaller binPath= "cmd /c TASKKILL /F  /IM notepad.exe\nsc start "TrustedInstaller"\n</code></pre>\n'}, {'answer_id': 67188769, 'author': 'GeekOnHeels01', 'author_id': 5691356, 'author_profile': 'https://Stackoverflow.com/users/5691356', 'pm_score': 1, 'selected': False, 'text': '<p>I had this issue too, here is how I solved it.</p>\n<p>1/ Open the «\xa0task manager «\xa0</p>\n<p>2/ Locate the application name in the list</p>\n<p>3/ Once found, right click on its name then click on «\xa0properties\xa0»</p>\n<p>4/ In the properties interface, click on «\xa0security «\xa0</p>\n<p>5/ Click on «\xa0edit\xa0» to change permissions</p>\n<p>6/ «\xa0Deny\xa0» all permissions for all users, click on «\xa0 apply\xa0» then «\xa0ok\xa0»</p>\n<p>7/ click on «\xa0advanced\xa0» for special permissions settings</p>\n<p>8/ Remove permissions for all users</p>\n<p>9/ click on «\xa0 apply\xa0» then «\xa0ok\xa0»</p>\n<p>10/ click on «\xa0 apply\xa0» then «\xa0ok\xa0» again</p>\n<p>11/ you can now kill the process on task manager as well as uninstall the app of you want to.</p>\n'}, {'answer_id': 72704655, 'author': 'Monsignor', 'author_id': 322984, 'author_profile': 'https://Stackoverflow.com/users/322984', 'pm_score': 0, 'selected': False, 'text': '<p><code>wmic process where processid=&quot;11008&quot; call terminate</code></p>\n'}]
['https://Stackoverflow.com/questions/49988', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1694/']