diff --git a/System-Automation-Scripts/Restart and shutdown pc/readme.md b/System-Automation-Scripts/Restart and shutdown pc/readme.md new file mode 100644 index 00000000..c5888d94 --- /dev/null +++ b/System-Automation-Scripts/Restart and shutdown pc/readme.md @@ -0,0 +1,2 @@ +Script added for restart and shutdown pc using python + diff --git a/System-Automation-Scripts/Restart and shutdown pc/shutdown_restart.py b/System-Automation-Scripts/Restart and shutdown pc/shutdown_restart.py new file mode 100644 index 00000000..2f1d2211 --- /dev/null +++ b/System-Automation-Scripts/Restart and shutdown pc/shutdown_restart.py @@ -0,0 +1,26 @@ +# Imprort OS library +import os + +# User input +option = int(input(""" +Enter input +[1] Shutdown +[2] Restart +[3] Quit +""")) + +# Function for shutting down pc +def shutdown(): + os.system('shutdown -s') + +# Function for restarting pc +def restart(): + os.system("shutdown /r /t 1") + +if(option == 1): + shutdown() +elif(option == 2): + restart() + +else: + exit() \ No newline at end of file