通过 PowerShell/cmd 为 Linux 个应用程序调用 Windows 子系统

Calling Windows subsystem for Linux apps through PowerShell/cmd

随着最近推动 Windows 内部人员构建 14316,我们有 Windows 子系统用于 Linux(测试版),允许 运行 Ubuntu Linux Windows 上的 CLI 软件。 它可以通过 Windows PowerShell 中的 运行ning bash 命令或通过 "Bash on Ubuntu on Windows" app.

启动

所以,我的问题是关于第一种方式。我们可以从 PowerShell 启动 bash,但是 none 其他 ubuntu CLI 应用程序可以从它获得。你如何完成一项工作?假设我希望 zsh 可以在不使用 bash 的情况下启动。

还没有,根据Windows Blog: Run Bash on Ubuntu on Windows

Third, note that Bash and Linux tools cannot interact with Windows applications and tools, and vice-versa. So you won’t be able to run Notepad from Bash, or run Ruby in Bash from PowerShell.

更多 in Microsoft/CommandLine-Documentation#32,这是关于 运行 win32 命令的相关能力 Bash:

Rest assured, we're going to be looking into the interop story in the future, but we won't be adding this capability in the Windows 10 Anniversary Update timeframe.

您可能会幸运地使用 bash-c 选项到 运行 特定命令。