Create timed tasks on window7 to run automated scripts

 

 

 

Stumbled and bumped, and finally finished writing the interface test script of a small module of the company, there are more than 20 in total! Later, I found that it is too troublesome to run the script executed with one key every day, so I want to use the windows timing task to solve this problem! I read an article today, so I decided to give it a try!

First go to the computer management of the window - then click to create a basic task:

Next enter your description. Next, choose how often your scheduled task will be executed:

Click Next, set [Operation] to [Start Program], and then click Next, the most critical place is here, how to fill in here to ensure that the system runs the Python program correctly?

 

 Without further ado, let's look at the specific settings:

 

The meaning of the contents of the three text boxes is explained here. The [Program or Script] text box is filled with the name of the Python compiler, usually python.exe, and the [Start in] text box is filled with the directory of the Python compiler. , the above figure assumes that the full path of your Python compiler is "C:\Python27\python.exe", the [Add parameter] text box is filled with the full path of your Python program, here it is assumed that the Users in the C drive Below the folder is a file called code.py. If your Python program contains command-line arguments, add them to the full path to the Python program.

 

I believe smart readers have discovered that if these three parts are connected together, it is "C:\Python27\python.exe C:\Users\code.py", which is actually entering "python C: \Users\code.py" (or "python code.py" if you happen to be in the C:\Users directory), just give the full path to the python compiler in the scheduled task settings.

After that, click Next and you can click Finish. Isn't it easy?

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325026252&siteId=291194637