Problems running python script by windows task scheduler that does pscp

后端 未结 6 1892
轮回少年
轮回少年 2020-12-08 23:16

Not sure if anyone has run into this, but I\'ll take suggestions for troubleshooting and/or alternative methods.

I have a Windows 2008 server on which I am running s

6条回答
  •  温柔的废话
    2020-12-08 23:31

    Brad's answer is right. Subprocess needs the shell context to work and the task manager can launch python without that. Another way to do it is to make a batch file that is launched by the task scheduler that calls python c:\path\to\script.py etc. The only difference to this is that if you run into a script that has a call to os.getcwd() you will always get the root where the script is but you get something else when you make the call to cmd from task scheduler.

提交回复
热议问题