Skip to content
This repository has been archived by the owner on Nov 30, 2022. It is now read-only.

Added script for shutdown and restarting PC #313

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions System-Automation-Scripts/Restart and shutdown pc/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Script added for restart and shutdown pc using python

Original file line number Diff line number Diff line change
@@ -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()