简体   繁体   中英

How to write windows service to schedule run python script in particular time

I want to run a python script at a particular time. say Everyday 10am or every 2 hours . How can I achieve that? I have read these questions- Q1 Q2

You don't need a service to schedule a Python script. Just use Windows Task Scheduler to run it. When I do this I usually wrap the invocation of Python in a batch file, so the scheduler runs mytask.cmd but you can also schedule a complete command line invocation of the interpreter, for example: c:\\python36\\python.exe mytask.py .

Task Scheduler is in the Control Panel. Open Control Panel, and in the top right hand corner ("Search Control Panel") type Schedule . One of the options you will get is Administrative Tools | Schedule tasks.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM