【发布时间】:2016-09-29 14:16:13
【问题描述】:
当我作为 exe (pidgin) 的子进程运行 bash -c(Windows 上 ubuntu 上 linux/Bash 的 windows 子系统的一部分)的批处理文件时,即使该 exe 在 Windows 中被提升/管理员批处理文件错误:
'bash' is not recognized as an internal or external command,
operable program or batch file.
我正在运行的 .bat 文件是:
bash -c "curl --silent -u '''my api key'':' -d type='note' -d body='My Message' -d title='My Subject' 'https://api.pushbullet.com/v2/pushes'"
pause #disable after debugging
我打算将它作为 pidgin 中的“伙伴突袭”,这样当我收到来自 Nickserv 的消息时,它会在任何地方通知我。
我也尝试直接从 pidgin 执行命令,而不是作为 bash 文件运行,但是 curl 从未发生过,而且我没有通过 pushbullet 收到通知。但是,如果我在 CMD 或 Run 中运行完全相同的命令,它将使用 bash 并成功执行 curl。
我也发现了这个问题:Calling Windows subsystem for Linux apps through PowerShell/cmd,但我不确定它是否回答了这无法完成,因为您显然可以将 bash 命令放入 bat 文件中。
【问题讨论】:
标签: windows bash batch-file windows-subsystem-for-linux