当我运行一个批处理文件bash -c
(Windows 上 ubuntu 上的 linux/Bash 的 Windows 子系统的一部分)作为 exe(pidgin)的子进程运行时,即使 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。
我还发现了这个问题:通过 PowerShell/cmd 调用 Linux 应用程序的 Windows 子系统,但我不确定它是否回答了这无法完成,因为您显然可以将 bash 命令放入 bat 文件中。