【发布时间】:2019-02-28 02:06:14
【问题描述】:
我正在编写一个 .net 核心应用程序以作为同步数据的作业运行。我已将 dotnet.exe 命令添加到 Path,当我直接在命令行中运行应用程序时效果很好。
我已经将应用程序部署到服务器并编写了一个批处理脚本(job.bat)来运行它,如下所示。
cd D:\the\folder\where\the\app\locate
dotnet TheJobToBeExecuted.dll
我想每 5 分钟运行一次作业,所以我使用下面的脚本将批处理添加到任务计划程序
schtasks /create /tn "Job" /tr "D:\the\folder\where\the\batch\locate\job.bat" /sc minute /mo 5
但这项工作没有按预期工作。然后我如下更改 job.bat 以查看发生了什么。
cd D:\the\folder\where\the\app\locate
dotnet TheJobToBeExecuted.dll
pause
消息如下所示
Did you mean to run dotnet SDK commands? Please install dotnet SDK from:
http://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409
但是我已经安装了dotnet并将其添加到服务器上的路径中,我也可以直接在服务器cmd上运行应用程序。
我错过了什么吗?谢谢。
【问题讨论】: