How can I close/open several programs at once using one hotkey?

1

1

I have a lot of things runnning on my Thinkpad T530. Sometimes I'd like to maximise battery life by closing several programs at once. I'd like to be able to reopen them when needed (with or without an AC adapter).

How can I assign a single hotkey to do this?

Modal

Posted 2013-07-16T00:28:32.057

Reputation: 93

Answers

1

You can do this using batch script.


Make the script that will initialize the programs desired by you, eg:

echo @off

:: example: start /d "dir" <file.exe>

start /d "c:\masm32\" qeditor.exe
start /d "c:\Program Files\VideoLAN\VLC\" vlc.exe

exit

Make the script that will finalize the programs, eg:

echo @off

taskkill /f /im vlc.exe
taskkill /f /im qeditor.exe

exit

Create shortcuts for both scripts:

  • Right-click the batch file, and then click Create Shortcut.

    enter image description here

Configure Hotkey:

  • Right-click the batch file and choose Properties.
  • In the Properties dialog, find the text box labeled Shortcut key.
  • Click in the text box and enter a key that you wish to use in your hotkey. If you choose a function key or a numeric keypad key, only that key will be used and Ctrl + Alt + will not be added.
  • Click OK.

enter image description here

stderr

Posted 2013-07-16T00:28:32.057

Reputation: 9 300

Wow, thank you for the simple and effective solution. I have to read more about batch files.

'Taskkill' is a bit too rough on programs like Firefox, but I don't mind closing them manually. I do wonder, however, if there's an alternative to 'taskkill' that functions like when Windows shutdown wants to close programs. – Modal – 2013-07-16T13:12:52.500

@Shane: Try taskkill without /f and see if it is able to close FF cleanly. – Karan – 2013-07-16T16:22:09.880