运行 从 windows 任务调度程序自动卷曲
run curl from windows task scheduler automatically
我有一个简单的单行 bat 文件,运行 是一个 curl localhost:port。我的 curl.exe 与 bat 在同一个文件夹中,我没有全局安装它。如果我双击它 运行 没问题,如果我在任务计划程序和 select 运行 任务中右键单击它也 运行 没问题。它还说它成功完成了 "scheduled tasks" 但没有任何反应(我确信这一点,因为我正在检查如果脚本是 运行 应该更新的数据,并且它不会发生在 scheduled/automatic 情景)。在阅读了大量用户问题后,我尝试以两种方式进行配置(全部更新 5 分钟):
普通方式
Action: Start a Program
Program/script: C:\p\updater.bat
Start in: C:\p\
其他方式
Action: Start a Program
Program/script: cmd
Add arguments: /c start "" "C:\p\updater.bat"
我已经设置了对 bat 和包含文件夹的权限,以允许所有人对所有人 users/etc。自动触发时都不起作用,也没有错误。我试过 Server 2008 和 Windows 10(我的 OS)模式。如果我右键单击 运行 任务,两者都有效,但都不是自动的,有什么想法吗?
计划脚本的默认工作目录是 %Windows%\system32。尝试在第一行添加 updater.bat:
cd c:\p\
为了诊断,您可以将输出重定向添加到 bat 文件中的命令:
echo Script Started >> c:\p\log.txt
curl SomeCommand SomeCommand >>c:\p:\curloutput.txt
echo Script Ended >> c:\p\log.txt
并在执行脚本后检查文件 log.txt 和 curloutput.txt
我有一个简单的单行 bat 文件,运行 是一个 curl localhost:port。我的 curl.exe 与 bat 在同一个文件夹中,我没有全局安装它。如果我双击它 运行 没问题,如果我在任务计划程序和 select 运行 任务中右键单击它也 运行 没问题。它还说它成功完成了 "scheduled tasks" 但没有任何反应(我确信这一点,因为我正在检查如果脚本是 运行 应该更新的数据,并且它不会发生在 scheduled/automatic 情景)。在阅读了大量用户问题后,我尝试以两种方式进行配置(全部更新 5 分钟):
普通方式
Action: Start a Program
Program/script: C:\p\updater.bat
Start in: C:\p\
其他方式
Action: Start a Program
Program/script: cmd
Add arguments: /c start "" "C:\p\updater.bat"
我已经设置了对 bat 和包含文件夹的权限,以允许所有人对所有人 users/etc。自动触发时都不起作用,也没有错误。我试过 Server 2008 和 Windows 10(我的 OS)模式。如果我右键单击 运行 任务,两者都有效,但都不是自动的,有什么想法吗?
计划脚本的默认工作目录是 %Windows%\system32。尝试在第一行添加 updater.bat:
cd c:\p\
为了诊断,您可以将输出重定向添加到 bat 文件中的命令:
echo Script Started >> c:\p\log.txt
curl SomeCommand SomeCommand >>c:\p:\curloutput.txt
echo Script Ended >> c:\p\log.txt
并在执行脚本后检查文件 log.txt 和 curloutput.txt