The below code is used to shutdown your system.
Here we will be using the OS module of python to run the command in cmd.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import time | |
print" HAI GOING TO SHUT DOWN" | |
#command the link with cmd | |
command ="shutdown /s" | |
ft=int(raw_input("ENTER THE SHUT DOWN TIME")) | |
while(1): | |
t=time.strftime('%H%M') | |
t=int(t) | |
ft=int(ft) | |
if t==ft: | |
os.system(command) #putting into the cmd prompt |
Here it takes the input time as for 24 hr clock ,so there is no need to specify for A.M or P.M.
No comments:
Post a Comment