Eu quero executar um comando no CMD para que ele seja executado no Bash.
Use wsl.exe
:
Run Linux tools from a Windows command line
Run Linux binaries from the Windows Command Prompt (
CMD
orPowerShell
) usingwsl.exe <command>
.Binaries invoked in this way:
- Use the same working directory as the current
CMD
orPowerShell
prompt.- Run as the WSL default user.
- Have the same Windows administrative rights as the calling process and terminal.
For example:
C:\temp> wsl ls -la <- contents of C:\temp ->
The Linux command following
wsl.exe
is handled like any command run in WSL. Things such as sudo, piping, and file redirection work.
Nota:
If you're running Creators Update or Anniversary Update, jump to the Creators/Anniversary Update section.
Fonte Interoperabilidade do Windows com o Linux | Microsoft Docs