Windows 10 comes with BASH, i.e. the Linux Subsystem on Windows 10. You will need to install it though if you wish to run shell script files on Windows 10. Windows also include Real Linux core which is useful when your scripts need Linux system function access which is not available in WSL. Here is how to enable or install BASH on Windows 10.
How to Enable or Install BASH on Windows 10
- Go to Settings > Apps and Features and click on the link Programs and Features on the top right.
- It will open the “Uninstall Program Section”. Look for an option which says ” Turn Windows Features on or off.” on the left. Click on it.
- In the list, find Windows Subsystem for Linux. Click on to checkbox and then on OK button to Install the feature.
- Restart the computer.
- Once you log in again, Command Prompt will launch. You will get a prompt telling that BASH will download from the store.
- Type Y and press Enter to download and install the necessary files from canonical.
- The whole process takes around 5 minutes, and at the end, it installs the file system.
Here is a video of how it works. Since the feature is out of beta, you will not have some extra prompt when installing it on the computer. Also, there is no need to enable developer mode or Windows Insiders any more.
It gets you native bash on Windows 10, and you can use bash tools like Ruby, Python, and so on. You can use the command prompt to run .SH or Shell Script files on Windows.
Run .SH or Script Files in Windows 10
If you have scripts which need original Linux Kernel, then you can use Ubuntu. Windows 10 v 1903 comes with real kernel core. Ubuntu lets you access files available in Windows (/mnt/c) which can be handy to execute those scripts.
When executing Shell Scripts from the Command Prompt, use BASH command. When running scripts from Ubuntu, you need to use SH command.