如何从 Windows 任务调度程序在(ubuntu bash windows 10)上运行程序

Posted

技术标签:

【中文标题】如何从 Windows 任务调度程序在(ubuntu bash windows 10)上运行程序【英文标题】:How to run program on ( ubuntu bash windows 10 ) from windows task scheduler 【发布时间】:2017-10-04 17:55:57 【问题描述】:

我需要在 ubuntu bash 中每 5 分钟执行一次任务,我喜欢使用 windows 任务调度程序。 我不知道如何编写 .bat 文件以在 ubuntu bash 中启动应用程序。 我测试了这些并没有工作。 c:\Windows\System32\bash.exe -l [程序名称参数]

【问题讨论】:

不清楚你想做什么,你能解释一下吗? 我需要在 ubuntu bash 中使用 windows 任务调度器来调度任务。 【参考方案1】:

可以在 ubuntu bash 上运行命令,在 args 中添加 -c 标志

c:\Windows\System32\bash.exe -c <command>

并将其写入.bat文件,然后添加到windows任务调度程序中。

【讨论】:

当我这样做时,我在结果中得到一个 0x75 代码并且脚本没有被执行。 打开 cmd 并尝试 bash.exe -c "echo hi" 检查一切是否正常 是用户未登录时运行的问题。谢谢。

以上是关于如何从 Windows 任务调度程序在(ubuntu bash windows 10)上运行程序的主要内容,如果未能解决你的问题,请参考以下文章

如何在 Windows 任务调度程序上安排 azcopy?

如何使用 Laravel 在 Windows 10 中运行任务调度程序

如何使用 Messagebox 在 Windows 7 任务调度程序中启动 VBS 脚本?

如何解决 Windows 10 调度程序错误

由 Windows 任务调度程序触发

windows任务调度程序和hangfire(或Quartz.net)有啥区别? [关闭]