When you try to launch Bash.exe (Bash on Ubuntu on Windows) in Windows 10, the console window may open and close immediately. This happens if legacy mode is turned on for Command Prompt.
Also, if you open a Command Prompt window and type bash.exe, the following error would show up:
If you have an existing Command Prompt shortcut (cmd.exe), right-click on the shortcut and click Properties. In the Options tab, disable the checkbox for Use legacy console (requires relaunch)
If you don’t have an existing shortcut to Command Prompt, open a Command Prompt window (cmd.exe), right-click on the title bar, and click Properties. From the Options tab, you can disable legacy mode. It would be applied globally.
To apply the settings for multiple systems using a script or batch file, here is the command you need for disabling legacy mode.
REG.EXE ADD HKCU\Console /v ForceV2 /t REG_DWORD /d 1 /f
After doing so, Bash should now launch correctly.
About the author
Ramesh Srinivasan founded Winhelponline.com back in 2005. He is passionate about Microsoft technologies and has a vast experience in the ITeS industry — delivering support for Microsoft's consumer products. He has been a Microsoft MVP [2003 to 2012] who contributes to various Windows support forums.