How can I force stop a program without using the mouse in Windows 10?

56

18

I'm trying to debug a Visual Studio C# Windows application that immediately takes over the desktop and disables mouse control. When it freezes, I need to be able to stop it somehow. I can press the windows key or ctrl-alt-delete and access the taskbar, but when I move the mouse onto the main part of my screen it's always an hourglass icon and I can't interact. So when I right-click to close the application on the taskbar and a dialogue pops up asking if I want to stop debugging, there's no way for me to click it. I also can't click on anything in task manager.

I looked into how to end tasks from command prompt, but the directions don't make sense. schtasks /end requires a task name argument that seems to take a path, but I have no way of knowing what the path is that I'm supposed to input. tasklist returns file names and ID numbers, but neither of those work for schtasks.

Does anyone have any suggestions?

Kyle Delaney

Posted 2017-03-18T13:47:43.723

Reputation: 1 059

3ALT+F4 will close any program on Windows – Ramhound – 2017-03-18T16:35:47.630

59@Ramhound Alt+F4 will send a window-close message to the application. If it's unwilling to handle it (e.g. by dropping the event or doing something else) this won't work. – Reinstate Monica - ζ-- – 2017-03-18T16:40:59.367

3@Ramhound It won't close non-GUI programs or programs that choose to ignore the close event. – Carey Gregory – 2017-03-18T16:42:34.250

1If the problem is that a dialogue pops up that can't be manipulated with mouse, you might simply be able to navigate it's buttons by tab or arrow keys and press them with space or enter. – Džuris – 2017-03-19T00:10:29.380

Yes, use the space and enter after the dialog box appears. – JDługosz – 2017-03-19T08:52:21.227

18pull the plug, afaik this worked for all versions of windows. – Display Name – 2017-03-19T09:11:38.000

10Using Ctrl+Alt+Del, Ctrl+Shift+Esc, Win+R and so one don't necessarily require you to use your mouse. Almost all of Windows's functionalities can be used using the keyboard only. For this, you can use the arrow keys, the tab key, or Alt key navigation. – BlueCacti – 2017-03-19T22:44:16.950

2Ctrl+Alt+Delete and then you need to exercise your Tab Fu – xDaizu – 2017-03-20T13:58:18.903

3@SargeBorsch - Doesn't work for my laptop. – Daniel R Hicks – 2017-03-20T20:06:40.030

@DanielRHicks does it have removable battery? – Display Name – 2017-03-20T21:31:46.837

Alt+F, x is my first goto. – mcalex – 2017-03-21T19:16:03.643

@mcalex This doesn't work if an application is unresponsive. – mbomb007 – 2017-03-21T21:19:24.990

Answers

89

You can use the command prompt to terminate processes:

  1. Open the Run box using Windows+R.
  2. Type cmd in the Run box and click Enter.
  3. Use the command tasklist to list all processes.
  4. Use the command taskkill /F /IM "executable name.exe" /T to terminate the process.

MJ9

Posted 2017-03-18T13:47:43.723

Reputation: 970

16Or just type cmd /C taskkill /f /im "<whatever>" /t in the "Run" window. – Ismael Miguel – 2017-03-18T16:41:15.397

1@IsmaelMiguel Yes, but you can't do tasklist in Run. – MJ9 – 2017-03-18T18:33:38.800

10@MJ9 You can, you just need to be a very quick reader :P – CodesInChaos – 2017-03-18T19:44:22.950

1@MJ9 The name of the process will be directly related to the name of the project. Since it is with the Visual Studio C#, the name of the process will be <project>.vshost.exe. If my project is called WindowsFormsApplication1, then the process to kill is WindowsFormsApplication1.vshost.exe. There's no need for tasklist. – Ismael Miguel – 2017-03-18T20:04:28.697

16@IsmaelMiguel You don't even need the cmd /C part; taskkill isn't a shell built-in. – wizzwizz4 – 2017-03-18T21:45:18.100

4@wizzwizz4 OMG! You're totally right! You can straight type taskkill there! I forgot that it is an executable placed inside system32 (if I remember correctly). This means, a huge reduction of steps. And once you've done this once, all you have to do is Win + R and then hit Enter. – Ismael Miguel – 2017-03-18T22:47:19.483

3@MJ9 "can't do tasklist in Run" cmd /K tasklist – user2428118 – 2017-03-19T20:28:25.003

Also, if you have the ID but not the name as in OP's post, you can do taskkill /PID <process id> – user2428118 – 2017-03-19T20:30:26.717

1why do you need to run tasklist? wildcards can be used with /IM options – phuclv – 2017-03-20T09:49:53.277

@IsmaelMiguel Why don't you update your answer without the cmd part? Or add it as an alternative for completeness? :) – xDaizu – 2017-03-20T14:01:24.133

@xDaizu That was already suggested and brushed off by me. Most of the content is already present in this answer, so, there's no need to repeat it. What I'm proposing (and that was refined by wizzwizz4) is just skipping steps. It isn't enough to make it into an answer. – Ismael Miguel – 2017-03-20T15:12:40.600

@LưuVĩnhPhúc Trust me, you don't want that. If you start killing random stuff, you kill stuff you need. – Ismael Miguel – 2017-03-20T15:16:01.433

@IsmaelMiguel I know, I was not suggesting a new answer, but a small edit. You know, you leave your answer as is, add an horizontal line and add the "improvement" (crediting @wizzwizz4) :) – xDaizu – 2017-03-20T15:23:47.013

@xDaizu But it isn't my answer... – Ismael Miguel – 2017-03-20T15:29:39.717

2

@IsmaelMiguel It's an ´improvement/alternative` built upon your answer, so you can include it. There's plenty of precedent here in Stack Overflow. If you want to update it. In the end it's your choice, of course :)

– xDaizu – 2017-03-20T15:40:45.103

1A quicker way to get an administrative cmd prompt (or PowerShell prompt, depending on how you've set it up) is to press Windows+X then A. – Greenstone Walker – 2017-03-20T21:11:59.910

You can do "tasklist | sort" to have the tasklist sorted alphabetically – nardnob – 2017-03-21T17:44:54.233

@GreenstoneWalker Your solution doesn't seem to work on Windows 7. Windows + X doesn't do anything on my PC (Windows 7 Ultimate x64 pt-pt). The Windows + R is available since (according to https://en.wikipedia.org/wiki/Run_command) Windows 95. Maybe it was introduced on Windows 8/8.1?

– Ismael Miguel – 2017-03-22T10:03:03.193

1@Ishmael, the question is tagged "Windows 10". The Windows X menu was, as you surmise, added in Windows 8. You would not believe how many times I try to use it in Win 7. :-) – Greenstone Walker – 2017-03-22T10:17:38.573

Thanks, this saved me time so many times with some games which hang and will never crash (even after End Task) or let me use Task Manager properly (an issue where the game always steals focus). Only restarting or killing the app like this does the trick. EDIT: – Tihomir S. – 2019-04-23T23:59:35.680

91

Try the following:

  1. Open the Task Manager by pressing Ctrl+Shift+Esc
  2. Navigate using the arrow keys ( and ) to highlight the problematic process
  3. Press the Delete key to kill the process
  4. If necessary, acknowledge the subsequent prompt by selecting the appropriate choice with the arrow keys ( or ) and press Enter

Run5k

Posted 2017-03-18T13:47:43.723

Reputation: 13 092

2You will need Del -> Enter; there's a prompt. – wizzwizz4 – 2017-03-18T17:30:26.510

@wizzwizz4 thanks for the feedback! That is a very good point. There isn't an additional prompt in some cases, but a program that is frozen will typically have one. I have added an additional step to the answer. – Run5k – 2017-03-18T20:26:24.200

In my version of Task Manager (Win 10 Home), the Delete key to kill a process pops up with the "are you sure you want to do this? this could pwn your system" message. I'd be interested to know which systems this doesn't always appear for. – wizzwizz4 – 2017-03-18T21:44:21.950

1@wizzwizz4 I think it also depends upon your target. On my Windows 10 Pro x64 machine I have tried it on Notepad, Paint, and the Settings app. Each of them closes without any additional prompts. – Run5k – 2017-03-18T22:06:41.447

This works! Thank you. I have a few choices for the correct answer here. I hope you don't mind me picking one with fewer votes. The arrow keys wouldn't respond the first time I tried your solution, so I'm going to say the other one is more consistent, and it has some good info about using the command prompt. – Kyle Delaney – 2017-03-19T01:40:45.070

@Run5k That could be it; I rarely have to terminate the built-in programs apart from the Settings app, and that might well have closed without a prompt. – wizzwizz4 – 2017-03-19T08:57:42.907

@wizzwizz4 Depends... on Windows 10, the "Processes" tab is closer to the Windows 7 "Applications" tab and it defaults to "End task" (which will try a safe exit first). It normally won't prompt. If you try to end a critical system process, it'll prompt you to shut down instead. However, if you use the "Details" tab (closer to Windows 7 "Processes"), you'll get the old "End process" (which goes and terminates it immediately) option and prompts. – Bob – 2017-03-20T01:44:40.357

I think that's exactly what's happened; I always use the Details tab, but that isn't described in the answer. – wizzwizz4 – 2017-03-20T07:28:15.347

In addition you can type the name of the program to highlight it. I always use this method to kill apps, also when the task manager is hidden behind the hanging app, this still works. – Mixxiphoid – 2017-03-20T10:46:59.223

@wizzwizz4 there is certainly nothing wrong with utilizing the Details tab, but I didn't describe it within my answer because I tried to keep the proposed solution rather simple and the Windows 10 Task Manager will open to the Processes tab by default. Along the same lines, if you have your UAC turned up to the highest setting you will need to acknowledge the prompt after you initially press Ctrl+Shift+Esc, but that isn't the default configuration so I didn't include it accordingly. – Run5k – 2017-03-20T14:57:44.107

@KyleDelaney you are quite welcome! Regarding the arrow keys, I actually tested this scenario ~100 times utilizing three different Windows 10 machines and it worked every time. I did test the process by "accidentally" hitting another key, and at times it appeared as though the arrow keys wouldn't respond. The answer you chose is a good one, and I was already aware of that method. My goal was to propose a solution for the community's benefit that was fast, reliable, and as simple as possible. However, whichever you prefer is the best solution and we are always glad to help! – Run5k – 2017-03-21T23:48:23.777

100 times? Goodness. How did you test having a frozen desktop? – Kyle Delaney – 2017-03-22T13:48:22.900

@KyleDelaney Needless to say, I didn't test while having a frozen desktop. Based upon your feedback, I was thoroughly testing how to "force stop a program without using the mouse in Windows 10" while targeting a wide variety of programs. – Run5k – 2017-03-22T15:12:23.017

11

A slight modification of the Taskkill answer: You can use wildcard if you don't remember/know the exact full name of the process, like so:

taskkill /f /im badproce*

It will kill all executables starting with that name, so make sure you don't just type something like s* because that could obviously kill critical processes like svchost.

Also, the /T flag is for killing the tree of processes, which is the target process and all the child processes it spawned. It may not be necessary most of the time.

user1306322

Posted 2017-03-18T13:47:43.723

Reputation: 4 237

1If I recall, it ignores important processes at least on Windows 10. I didn't know that it accepted a wildcard. Thanks. – Codingale – 2017-03-20T13:00:44.170

1This reminds me of a very dumb thing I did when I started working: I had to write a script that killed some processes of which I had the PID, on a Unix machine. I don't remember the details, but I was parsing the output of ps -ef with a regex containing the PID, and if it matched I had to send a kill -9. Now, for some reason, my regex didn't match, so I tried to make it "broader". It didn't work. Then broader, then broader... Frustrated, I decided to try something that worked for sure, and I used /2/ as regex for the PID. Yay, it worked! kill -9 to all the PIDs containing 2... X_X – Fabio says Reinstate Monica – 2017-03-22T13:03:16.483

I still remember my surprise when I hit enter and the shell I was using was closed. Then I realized what had happened. To top it off, kill doesn't work on processes of other users, but unfortunately we were like 20 people sharing the same account on that machine... It wasn't a funny day. The moral of the story is: if you use wildcards, pay a lot of attention! – Fabio says Reinstate Monica – 2017-03-22T13:04:31.230

9

Microsoft/Sysinternals' pskill tool can be used to kill a process via a command prompt, and it allows you to kill processes by process ID numbers or by process name. It also can be used to kill processes remotely: if the misbehaving program also managed to prevent you from using the keyboard, you could install pskill on another machine on your local network to kill the offending process.

jamesdlin

Posted 2017-03-18T13:47:43.723

Reputation: 1 973

7

You can kill the process from another device.

Alternative A: In "Settings -> For Developers -> Enable Device Portal". If you enable it, you get a web portal you can access from any other web-browsable device. With it you can list the running processes, and according to the documentation:

On some platforms (Desktop, IoT, and HoloLens) you can terminate processes.

Unfortunately, it currently doesn't seem to work on my computer, clicking on the "X" buttons besides each process does nothing.

Alternative B: If you have a Windows Mobile or another windows device, you can install the VoiceWake app from the Store, and its server component on your computer. Then you can use the app to kill the process remotely.

And there are certainly other applications out there that does the same.

emptyother

Posted 2017-03-18T13:47:43.723

Reputation: 173

This is a very clever idea! I'd prefer not to take the time to test it though, since I already have some working solutions. I think this is a good fallback in a situation where the keyboard doesn't respond. – Kyle Delaney – 2017-03-19T01:41:59.857

5

I am not sure where the trouble with Ctrl+Alt+Del is occurring, but I am able to use it along with the arrow keys to open the Task Manager. From there, you can follow the answer provided by @Run5K to end processes:

  1. Press Ctrl+Alt+Del
  2. Use the arrow keys to select Task Manager, and press Enter to open (I had to press Enter twice open Task Manager)

  3. When the permissions dialog box appears, use the arrow keys and Enter to select Yes to allow Task Manager permission to make changes

    From here, you can follow @Run5k's answer from list item (2):

  4. Use the arrow keys (Up and Down) to select the process desired to end. You can also use the Left and Right arrows to open/close collapsed/expanded items and end sub-processes

  5. Use Delete to end the process
  6. Use the arrow keys and Enter to manage any dialog boxes that may appear

Doug B

Posted 2017-03-18T13:47:43.723

Reputation: 59

1

If you are debugging an application, you can press Shift+F5 in visual studio to close the running instance.

Of course if you are in run mode you should rely on the other answers.

Goufalite

Posted 2017-03-18T13:47:43.723

Reputation: 121

1What is the MAJ key? Do you mean Shift? – Mixxiphoid – 2017-03-20T10:48:04.313

1Oops! Correct! Editing my answer – Goufalite – 2017-03-20T12:11:28.247

1

Many years ago, when mice didn't exist I used to close an application by pressing F10 to get into the menu bar, arrow down to open the menu, arrow left to get into the system menu and then arrow up to get to "Close" and press enter. It still works with simple applications like Notepad, depending on the kind of menu they have. (I don't remember why I favoured that over Alt-F4 at that time, maybe it was more impressing for people watching you doing it ;)

IngoB

Posted 2017-03-18T13:47:43.723

Reputation: 119

Does your method work in Windows 10? OP asks specifically about Windows 10 (see the Windows 10 tag). Update your answer if it works in Windows 10 or remove it. – alljamin – 2017-03-21T03:51:57.793

1@alljamin : sure. This is CUA (Common User Application) equivalent of pressing Alt to get a menu. And CUA is widely supported by many Windows applications. (other examples: Shift-Del for cut, Shift-Ins for insert.) Widely supported, including Windows 10. – TOOGAM – 2017-03-21T05:48:40.193

Alt+Space,C is a similar approach. – RJFalconer – 2017-03-21T16:01:41.240

1

I use Ctrl + Shift + Esc Then I get the Task manager window. With Alt-Tab I try to switch to task manager, and then I navigate trough open apps with arrow keys. When you select your application, just press Delete button.

H3NDRX

Posted 2017-03-18T13:47:43.723

Reputation: 27

-1

Open Run Box and type:

cmd /c tskill process_name 

tskill is a program file in the dir C:\windows\system32

Vishal choudhary

Posted 2017-03-18T13:47:43.723

Reputation: 1

2no need for cmd /c – phuclv – 2017-03-20T09:48:49.097

-3

ALT-F4 is the quickest way.

Another option without using mouse is CTRL+ALT+DEL, Task manager and kill required application

Kunalpod

Posted 2017-03-18T13:47:43.723

Reputation: 1