Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

shutdown/restart/hibernate/logoff windows with python

# This is for a windows operating system
# We will use the os library
import os

# os.system is basically running a cmd command

os.system("shutdown /s") #shutdown
os.system("shutdown /r") #restart
os.system("shutdown /l") #logoff
os.system("shutdown /h") #hibernate

#for a full list of commands, go into Command Prompt and type "shutdown"
Comment

PREVIOUS NEXT
Code Example
Python :: install python-dev packages 
Python :: sns title 
Python :: check 32 or 64 bit python 
Python :: conda install spacy 
Python :: python matplotlib log scale 
Python :: extended euclidean python 
Python :: pygame.rect parameters 
Python :: python check if string is date format 
Python :: plt to png python 
Python :: convert date time to date pandas 
Python :: how to convert list into csv in python 
Python :: finding email id from string python 
Python :: make a list from 0 to n python 
Python :: linux python installation wheel 
Python :: python find smallest element in dictionary 
Python :: how to read video in opencv python 
Python :: pig latin translator python 
Python :: pytube urllib.error.HTTPError: HTTP Error 410: Gone 
Python :: install python on windows subsystem for linux 
Python :: index in zip python 
Python :: create a relu function in python 
Python :: folium anaconda 
Python :: plt tight layout 
Python :: get date and time in python 
Python :: path sum with python 
Python :: pygame how to make a transparent surface 
Python :: convert json to x-www-form-urlencoded pyhon 
Python :: dataframe from two series 
Python :: How to fix snap "pycharm-community" has "install-snap" change in progress 
Python :: import sklearn linear regression 
ADD CONTENT
Topic
Content
Source link
Name
2+5 =