How To: Execute .SH Files on Windows



RECOMMENDED: Click here to fix Windows errors and optimize system performance

These script files were not developed for Windows and only work on Unix systems (Linux and MacOS, plus many others, less popular).

What is a .sh file?

Developer files known as scripts that the Bash application programs and uses. SH files are known to be created and stored in the Bash language because the instructions they contain are written in that language. SH files can be executed when text commands are entered in the shell command line interface. SH files are mainly used by program developers and these files are important for the Bash application because the application mainly uses scripts and commands that must be executed for this application to work. And since SH files are the scripts programmed with this application and contain the commands to run the program, they are indeed important. The commands contained in SH files vary, and the SH file extension is now developed into an interactive shell, although it is originally a scripting language. Programs such as C-Shell, Korn Shell and Bourne Shell also use SH files to store scripts.

If you want to run the script as a native Windows application, you can’t.

But if you’re willing to live with using it only in a Linux prompt, you have two choices.

  • The classic option has always been Cygwin. It is a vm shell that runs Linux applications and scripts. (I have no experience with this)
  • Under Windows 10 they have Bash on Ubuntu on Windows. This is a Linux subsystem supported by Microsoft. It has no GUI options and unfortunately all you have to do is install it on the c drive. (I have experience with this)


Fix Update July 2019:

We recommend you try using this new tool. It fixes a wide range of computer errors, as well as protecting against things like file loss, malware, hardware failures and optimizes your PC for maximum performance. It fixed our PC quicker than doing it manually:

  • Step 1 : Download PC Repair & Optimizer Tool (Windows 10, 8, 7, XP, Vista – Microsoft Gold Certified).
  • Step 2 : Click “Start Scan” to find Windows registry issues that could be causing PC problems.
  • Step 3 : Click “Repair All” to fix all issues.

download
(optional offer for Advanced System Repair Pro -> Website | EULA | Privacy Policy | Uninstall)



Note that you can only use the script or its result (an installed application, etc.) from this Linux interface. Compilers and libraries created for Windows do not work in the shell either.

Running SH files with Cygwin

Cygwin is an open source command line interface environment similar to Unix. It allows you to compile and run Unix or Linux applications on a Windows operating system in a Linux-like interface. Cygwin allows us to run SH files without any problems.

  1. Visit the official Cygwin page to download the 32-bit or 64-bit installation file: Cygwin
  2. Open the downloaded installation file and follow the process of downloading and installing Cygwin. There are several options in the installation process, so choose the one you prefer.
  3. After installation, open Cygwin64 Terminal by double-clicking on the shortcut on the desktop.
  4. Now use the following command to move to the directory where the file is located:

cd C:User/User name/Desktop

This changes the directory to desktop. Now enter the following command to execute the SH file:

sh windowsbulletin.sh

Using the Windows subsystem for Linux

This is a feature that has been integrated into Windows. Unlike installing Linux in a virtual machine, the Windows subsystem for Linux can be called immediately from the Start menu.

However, for this to work, you must first activate the function.

Once the Windows for Linux subsystem is installed on Windows 10, you can run Linux in command line mode. This gives you access to the Bash shell on your Windows PC!

CONCLUSION

Microsoft continues to invest in the development of Windows 10 as the best productivity operating system, and in the anniversary update, the company includes not only major improvements and changes, but also great functionality for developers. We’re talking about the Linux Bash Shell, and that’s a big problem.

Bash Shell is simply a command line program that has long been part of Linux and is often used by developers. Microsoft added it with Anniversary Update directly in Windows 10, and everything works thanks to the new Windows subsystem for Linux.

https://stackoverflow.com/questions/26522789/how-to-run-sh-on-windows-command-prompt/37478310



RECOMMENDED: Click here to troubleshoot Windows errors and optimize system performance