To shut down your computer, type shutdown /s.
To restart your computer, type shutdown /r.
To log off your computer type shutdown /l.
For a complete list of options type shutdown /?
import os
def shutdown():
#shutdown /s -> shuts down the computer [but it takes time]
#also shows message windows is going to be shutdown within a minute
#to avoid this we use /t parameter time=0seconds /t0
#command = shutdown /s /t0
#execute to the shell
os.system("shutdown /s /t0")
a = input("What to do?")
if a == "shutdown":
shutdown()
该功能应在以下情况下发挥作用:
从https://its.uiowa.edu/support/article/109196引用:
是的,在窗户的情况下很容易
windows内置了用于即时关机的命令
shutdown /s /t0
代码:
相关问题 更多 >
编程相关推荐