Kei*_*ith 8 windows bash shortcuts cmd.exe windows-subsystem-for-linux
我创建了一个 Windows 快捷方式,其目标看起来像
"C:\Windows\System32\bash.exe" php /c/script.php
(我知道我可以使用我的 php cli 的 Windows 版本来运行它,但出于好奇)
当我单击我的快捷方式时,它只是弹出一个 cmd 窗口并关闭(脚本应该需要几分钟才能运行。
有没有办法将命令通过管道传输到 Windows 上的 bash.exe?
Bis*_*iyo 11
首先,bash.exe 已被弃用。您应该wsl.exe
在命令行中使用。使用 Windows Insiders Builds 17063 及更高版本来实现 WSL 中的互操作性功能。对于您的情况,这两种方法都可能有效:
wsl.exe php /mnt/c/MyFiles/test.php
wsl.exe --exec php /mnt/c/MyFiles/test.php
Run Code Online (Sandbox Code Playgroud)
以下是wsl.exe
使用信息:
用法:wsl.exe [参数] [选项...] [命令]
运行 Linux 二进制文件的参数:
Run Code Online (Sandbox Code Playgroud)If no command line is provided, wsl.exe launches the default shell. --exec, -e <Command> Execute the specified command without using the default Linux shell. -- Pass the remaining command line as is.
有关更多详细信息,请阅读WSL 与 Windows 的互操作性。
如果这是 WSL,请使用bash.exe -c "command to run",如
C:\Windows\System32\bash.exe -c "vi ~/.bashrc"
或者
C:\Windows\System32\bash.exe -c "php /mnt/c/script.php"
归档时间: |
|
查看次数: |
6858 次 |
最近记录: |