Tuesday, March 8, 2016

System Shutdown timer using python


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.
        
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
view raw shutdown.py hosted with ❤ by GitHub

 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