Python Program/Script to Stop Windows Applications/Shutdown Computer

3,875

9

Posted in TechnologySoftware

Introduction: Python Program/Script to Stop Windows Applications/Shutdown Computer

About: Occupation: Tech Support

# Program that will stop common Windows applications and shut the computer down
# For the truly lazy. :-)

print ("Stopping applications now")
# import the operating system module
# allows user to run operating system commands from Python
import os
# Run the command "taskkill" to stop applications in Windows
os.system("taskkill /f /im notepad.exe")
os.system("taskkill /f /im winword.exe")
os.system("taskkill /f /im excel.exe")
os.system("taskkill /f /im powerpnt.exe")
os.system("taskkill /f /im outlook.exe")
os.system("taskkill /f /im chrome.exe")
os.system("taskkill /f /im calc.exe")
os.system("taskkill /f /im iexplore.exe")
os.system("taskkill /f /im powershell.exe")
os.system("taskkill /f /im wordpad.exe")

# use the template below to add more applications
# os.system("taskkill /f /im [executable name].exe")
# shutdown the computer in 1 second
os.system("shutdown /s /t 1")

Share

    Recommendations

    • Woodworking Contest

      Woodworking Contest
    • Microcontroller Contest

      Microcontroller Contest
    • Make it Move Contest

      Make it Move Contest
    user

    We have a be nice policy.
    Please be positive and constructive.

    Tips

    Questions

    Comments