I really like coding in bash, but there used to be many limitations of bash functionality in Windows. Though now there are many benefits to the bash windows users now rather than how it was pre windows 10. However, with all of the improvements, there is one thing that I feel leaves to be desired for me. The default behavior of the double-click of .sh files never really was able to do anything in windows, the .sh file extension isn't even available in the "choose default apps by file type" section of the settings. I had a desire to be able to change the default action for .sh files but neglected it and shook it off for a while, but this link finally gave me hope.

Before Ubuntu terminal and the addition of Windows subsystem for Linux, there was really no way to access bash terminal on Windows without a VM. Now with the addition of Windows Terminal which combines Microsoft Azure Terminal, Command Prompt, Powershell, and Ubuntu, it is really awesome for people like me, but despite the new awesome additions to windows allowing further integration of Linux terminal into Windows, even being able to edit the C: drive with Ubuntu.

I am sure there is a way to allow double-click of .sh files to open in windows terminal Ubuntu, but I don't know how. This question helped me on my journey to figure out how to do it and helped me make the default .bat file behavior change to Windows terminal, but I still have come to an enpass where I truly believe that it is not possible. So here is where I go when I have given up, the magical land of Stack Overflow and Super User :)


  1. So far I have looked into the "Choose default apps by file extension" section of settings and could not find .sh in there nor could I find it in any of the default apps sections of normal settings.
  2. After I couldn't find anything about .sh in settings, I looked into the registry and looked for HKEY_CLASSES_ROOT and looked for sh or anything bash file related in HCR alone, HCR\*\shell, HCR\*\shellx, and HCR\*\Openwithlist and could not find anything.
  3. I then tried to do ftype, but I could not find how to use ftype with .sh. I tried doing ftype .sh="C:\Users\asian\AppData\Local\Microsoft\WindowsApps\wt.exe" -p "Ubuntu" "%1" %* but i got the error "File type '.sh' not found or no open command associated with it."
  4. I Also tried just clicking the .sh file so it brings up the "How do you want to open this file" menu and went to Windows Terminal but it opened the bash file in powershell with the error [error 0x800700c1 when launching `C:\Users\asian\Desktop\test.sh']
    These where everything I could think of and none of it was working. Help and pointers are appreciated. Thank you!

1 Answer 1


Right click .sh file -> Open with -> choose other app -> more apps -> look for other apps on this PC, select "C:\Windows\System32\bash.exe"

You can have more options which are documented here

  • Thank you! This works, but my question was about windows terminal so unfortunately this doesn't meet the criteria I wanted. Commented May 13, 2020 at 15:12
  • Sorry, I misunderstood. I think the issue is in lauching a .sh file with wt.exe itself. I just tried "C:\Users\Admin\AppData\Local\Microsoft\WindowsApps\wt.exe -p "Ubuntu" d:\test.sh" in run but it failed with [error 0x800700c1 when launching `d:\test.sh']. But when I tested a bat file with command prompt with "C:\Users\Admin\AppData\Local\Microsoft\WindowsApps\wt.exe -p "Command Prompt" d:\a.bat" at run, it works as expected. If we sort out this, we can at least make a batch file with line "C:\Users\Admin\AppData\Local\Microsoft\WindowsApps\wt.exe -p "Ubuntu" %1" and point it with choose app
    – Prabath
    Commented May 13, 2020 at 16:16
  • I have tested using wt.exe -p "Ubuntu" in command prompt and it opens Ubuntu like intended, so I don't think the issue is with wt.exe since the errors I got all related to the .sh file type. Thank you for your input! Commented May 13, 2020 at 16:31
  • We need to somehow change windows file path to linux file path format before passing it as an argument to bash with wt.exe (for an example, if we need to executebash /mnt/d/test.sh in cmd,in order to execute d:\test.sh in bash inside cmd prompt). I still couldn't figure out a correct way to make this work with wt.exe. This is being taken care of, when we double click and execute .sh file in explorer with registry key Computer\HKEY_CLASSES_ROOT\Applications\bash.exe\shell\open\command with value "C:\Windows\System32\bash.exe" -c " \"./$(grep -oE '[^\\]+$' <<< '%L')\"; cd ~; bash"
    – Prabath
    Commented May 13, 2020 at 18:55
  • I see... But why would doing that be necessary if we are running ubuntu from a windows device? It's not like Ubuntu in windows terminal's filepath "C:\Users\asian\AppData\Local\Microsoft\WindowsApps\wt.exe -p "Ubuntu" specifically suddenly changes to have to be a linux file path. Commented May 13, 2020 at 19:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .