Newbie
Newbie

Reputation: 1613

How to shut off a certain process on windows?

I have some .exe name i want to terminate if its running, how?

Edit: I modified mike's example to this, and its perfect:

WinExec("taskkill /IM notepad.exe /F", SW_HIDE);

Upvotes: 0

Views: 2411

Answers (2)

Mike
Mike

Reputation: 1008

If you know the name of a process to kill, for example notepad.exe, use the following command from a command prompt to end it

taskkill /IM notepad.exe

This will cause the program to terminate gracefully, asking for confirmation if there are unsaved changes. To forcefully kill the same process, add the /F option to the command line. Be careful with the /F option as it will terminate all matching processes without confirmation.

Upvotes: 0

Related Questions