Skip to content

Instantly share code, notes, and snippets.

@qzcool
Last active June 14, 2018 06:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save qzcool/6ece1b938298baa8eeef8ef7a1e2d6e3 to your computer and use it in GitHub Desktop.
Save qzcool/6ece1b938298baa8eeef8ef7a1e2d6e3 to your computer and use it in GitHub Desktop.
[Windows] program kill functions, currently including Excel and Chrome.
import psutil
# Chrome App Kill
def kill_chrome():
for proc in psutil.process_iter():
if 'chrome.exe' in proc.name():
proc.kill()
import psutil
# Excel App Kill
def kill_excel():
for proc in psutil.process_iter():
if 'EXCEL.EXE' in proc.name() or 'Microsoft Excel' in proc.name():
proc.kill()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment