How to send Shutdown command to process through CMD Prompt on Windows

Senad Meškin picture Senad Meškin · Jul 26, 2011 · Viewed 14.1k times · Source

I'm currently working as software developer and I'm using bunch of tools, so I need to close them all when finished with the work. So what I have done I have created batch file with the tskill command and list of programs that i use e.g.

tskill skype
tskill outlook
tskill devenv
tskill explorer
start explorer

There is one problem with this, changes in tools are not saved when process is killed, for exampl last project, opened files, visual positions of controls and all other stuff. These settings are saved only when you close your tool, but it's really time consuming to click each of them.

So my question is: Can I send shutdown command to software instead killing process?

Note: I need command for CMD, not programing solution, as I have mentioned above I need command like "tskill skype" which kills skype process. Windows can send this command, because when you shutting down your windows, windows is sending shutdown command to all running programs. But if can't be shutdown then windows kill process as I do it above.

Thanks in advance.

Answer

ddso picture ddso · Jul 28, 2011

Tested on Windows 7:

taskkill /IM notepad.exe

Note that you have to specify the .exe extension. I assume this does what you need: It doesn't simply kill the process, but sends the "shutdown" signal, which will display the "Save unsaved changes?" dialog in Notepad and other editors.