Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
635 views
in Technique[技术] by (71.8m points)

linux - How can I run a Windows executable from WSL (Ubuntu) Bash

Along with Windows 10 Anniversary update for summer 2016, came the possibility to run ubuntu binaries inside the new Windows Subsystem for Linux (WSL), a "lightweight" virtualized subsystem.

Unfortunately, launching C:WindowsSystem32ash.exe, another bash ELF binary starts a process inside the WSL, from where you cannot escape! You may launch only other ELF binaries.

So how can I execute *.exe files from Windows Bash?[1]

[1] Question asked also in Microsoft's "official" GH support repo.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

In the Windows 10 Creators Update (build 1703, April 2017), this is natively supported. So you can now run Windows binaries from Linux...

notepad.exe or any other .exe (the extension is needed and it needs being on your path, some older versions need the whole path)

...and vice versa using one of the following:

  • bash.exe -c command_to_run i.e: bash.exe -c ls
  • bash -c command_to_run i.e: bash -c ls
  • wsl command_to_run i.e: wsl "ls"; or specify the distro you want to use to run it using:
    • ubuntu run ls

For more information, see the above linked article.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...