Windows 7 任务计划程序
对此非常陌生,我不知道从哪里开始。
我想在 Windows 7 中使用任务计划程序安排一个 python 脚本。当我添加“新操作”时,我将以下命令作为脚本/程序:
c:\python25\python.exe
As参数中,我将完整路径添加到 python 脚本的位置
path\script.py
这是我的脚本:
import datetime
import csv
import os
now = datetime.datetime.now()
print str(now)
os.chdir('C:/Users/Brock/Desktop/')
print os.getcwd()
writer = csv.writer(open("test task.csv", "wb"))
row = ('This is a test', str(now))
writer.writerow(row)
我收到一条错误消息,指出脚本无法运行。非常感谢您为我的启动和运行提供的任何帮助!
谢谢,
布洛克
Very new to this, and I have no idea where to start.
I want to schedule a python script using Task Scheduler in Windows 7. When I add a "New Action", I place the following command as the script/program :
c:\python25\python.exe
As the argument, I add the full path to the location of my python script
path\script.py
Here is my script:
import datetime
import csv
import os
now = datetime.datetime.now()
print str(now)
os.chdir('C:/Users/Brock/Desktop/')
print os.getcwd()
writer = csv.writer(open("test task.csv", "wb"))
row = ('This is a test', str(now))
writer.writerow(row)
I got an error saying the script could not run. Any help you can provide to get me up and running will be very much appreciated!
Thanks,
Brock
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不确定如何通过 GUI 正确执行此操作,但是请参阅此处以获得一个不错的解决方案涉及
schtasks
命令。Not sure how to do it properly through the GUI, but see here for a nice solution involving the
schtasks
command.