how to schedule python script in windows
In CMD for Windows 10/11:
> at æ "ø"
Insert time instead of æ, for example like this: at 10:25 "ø"
Insert path to file instead of ø, for example this: C:\Users\Clumsy\AppData\Local\Programs\Python\Python39\myscript.exe
This also works for .ahk and .py scripts, and I think it works with others (such as .js and .bat)
schedule computer shutdown python
import schedule
import time
import os
when= "20:11"
print("The computer will be shutdown at " + when + "")
def job():
os.system("shutdown /s /t 1")
schedule.every().day.at(when).do(job)
while True:
schedule.run_pending()
time.sleep(1)
|