简体   繁体   中英

Running Python Scripts using task scheduler and bat files not working

This seems to be a recurrent question in many forums but after applying most of the solutions found, it's still not working.

The end of my python scripts creates two CSV files using the following code:

file1.to_csv(csvfilename, sep=",", encoding='utf-8', index=False)
file2.to_csv(csvfilename2, sep=",", encoding='utf-8', index=False)

I created a bat file within the same folder of my python script with the following code in:

@echo off
"C:\Program Files\Python35\python.exe" "Pythonscript1.py"

And in the task scheduler i created a task. I added an action and modified the Program/script with the path of my bat file:

"C:\Users\name\PycharmProjects\Templates\executePy.bat"

After run the task, no csv files have been created.

您的任务计划程序不在Python脚本所在的目录中工作。最好使用脚本的绝对路径指向该脚本,以免造成歧义。

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