Existe uma maneira de executar um comando Bash do CMD?

0

Eu quero executar um comando no CMD para que ele seja executado no Bash.

Por exemplo, open bash.exe "cd .." e isso deve abrir o Bash, execute cd.. . (Estou ciente de que meu exemplo não funciona).

Quaisquer pensamentos e ideias?

    
por Gers Pardoel 29.07.2018 / 22:21

1 resposta

0

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 or PowerShell) using wsl.exe <command>.

Binaries invoked in this way:

  • Use the same working directory as the current CMD or PowerShell 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

    
por 29.07.2018 / 22:30