60

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
  • 1,275

11 Answers11

100

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
  • 1,080
93

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
  • 16,463
  • 24
  • 53
  • 67
12

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
  • 4,866
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
  • 3,314
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.

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
  • 159
2

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
  • 37
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
  • 121
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
  • 119
-1

Open Run Box and type:

cmd /c tskill process_name 

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

-3

ALT-F4 is the quickest way.

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