Linux – Make a shortcut to Ubuntu bash.exe on Windows 10 that doesn’t auto-close

file-shortcutshortcutswindows 10windows-subsystem-for-linux

I would like to make a shortcut on Windows 10 that opens C:\Windows\System32\bash.exe (Ubuntu on Windows 10), runs a command and doesn't close the terminal.

I made a shortcut with target to C:\Windows\System32\bash.exe -c free and it runs the "free" command but closes the terminal right after running it. How to prevent it from closing?

Also what would be better: is there a way to load a bash script using such a shortcut (a set of commands located in a text file that such a shortcut would open and execute one after another) without closing the terminal after the execution? I suppose preventing the terminal from closing when running a "target" and a text file would be two separate methods?

Best Answer

You can create a shortcut from the Application folder:

  1. Access the Application folder by entering explorer shell:AppsFolder in Windows Command Prompt.
  2. Right-click on Ubuntu or other applications -> Create shortcut
  3. Click Yes on the msgbox saying the shortcut can be placed on the desktop.
  4. Enjoy!
Related Question