如何让Windows 10任务计划程序运行Python脚本?

时间:2017-09-08 03:55:39

标签: python windows python-3.x windows-10 scheduled-tasks

我无法让Windows 10 Task Scheduler运行Python脚本。我已经设置了调度程序来运行python.exe程序,并且我传入了我想作为参数运行的.py脚本,但是令人困惑的是它无法运行。 Python脚本是一个工作脚本。

有人能告诉我他们认为我可能做错了吗?

显然,Windows任务将导出为xml文件。这是Windows任务。

<?xml version="1.0" encoding="UTF-16"?>
<Task xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task" version="1.4">
    <RegistrationInfo>
        <Date>2017-09-07T16:03:54.7948519</Date>
        <Author>LAPTOP-K2677IHO\keith</Author>
        <Description>Runs python script to collect rs stock data.</Description>
        <URI>\CollectRSStockData</URI>
    </RegistrationInfo>
    <Triggers>
        <CalendarTrigger>
            <StartBoundary>2017-09-07T16:00:32</StartBoundary>
            <Enabled>true</Enabled>
            <ScheduleByDay>
                <DaysInterval>1</DaysInterval>
            </ScheduleByDay>
        </CalendarTrigger>
    </Triggers>
    <Principals>
        <Principal id="Author">
            <UserId>S-1-5-21-296473394-3322303487-2558410130-1001</UserId>
            <LogonType>InteractiveToken</LogonType>
            <RunLevel>LeastPrivilege</RunLevel>
        </Principal>
    </Principals>
    <Settings>
        <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
        <DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries>
        <StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>
        <AllowHardTerminate>true</AllowHardTerminate>
        <StartWhenAvailable>false</StartWhenAvailable>
        <RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
        <IdleSettings>
            <StopOnIdleEnd>true</StopOnIdleEnd>
            <RestartOnIdle>false</RestartOnIdle>
        </IdleSettings>
        <AllowStartOnDemand>true</AllowStartOnDemand>
        <Enabled>true</Enabled>
        <Hidden>false</Hidden>
        <RunOnlyIfIdle>false</RunOnlyIfIdle>
        <DisallowStartOnRemoteAppSession>false</DisallowStartOnRemoteAppSession>
        <UseUnifiedSchedulingEngine>true</UseUnifiedSchedulingEngine>
        <WakeToRun>true</WakeToRun>
        <ExecutionTimeLimit>PT72H</ExecutionTimeLimit>
        <Priority>7</Priority>
    </Settings>
    <Actions Context="Author">
        <Exec>
            <Command>"C:\Program Files\Python36\python.exe"</Command>
            <Arguments>"C:\Users\keith\Documents\scripts\python.scripts\rsstocks\main.py"</Arguments>
        </Exec>
    </Actions>
</Task>

0 个答案:

没有答案
相关问题