1

当我运行一个批处理文件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。 buddy pounce配置的pidgin ui

我还发现了这个问题:通过 PowerShell/cmd 调用 Linux 应用程序的 Windows 子系统,但我不确定它是否回答了这无法完成,因为您显然可以将 bash 命令放入 bat 文件中。

4

2 回答 2

1

您是否尝试过在批处理文件中完全指定 bash shell 的路径?

如果你用 c:\Windows\System32\bash.exe 替换 curl.bat 文件中的 bash 命令,事情可能会更好一些。似乎 pidgin 没有可用于它产生的进程的完整路径环境变量。

于 2016-10-16T11:55:35.437 回答
0

将路径更改为 C:\Windows\sysnative\bash.exe。Pidgin 是 32 位的,因此它将 C:\Windows\System32 别名为 C:\Windows\SysWOW64,将 C:\Windows\sysnative 别名为 C:\Windows\System32。MS 将 SysWOW64 中的 bash.exe 符号链接到真实的可能是有意义的。

于 2016-10-30T10:17:46.257 回答