How To Run A Script In Windows Command Prompt
Shell Scripts or .SH files are like batch files of Windows which can be executed in Linux or Unix. Information technology is possible to run .sh or Crush Script file in Windows 10 using Windows Subsystem for Linux. In this mail, we volition show you how to run a Beat out Script file in Windows xi/x.
How to run .sh or Trounce Script file in Windows 11/10
Fustigate is a Unix beat out and control language which tin can run Crush Script files. Yous practice not demand to install Ubuntu or whatsoever other Linux Distros unless your scripts need the support of the real Linux kernel. We will share both the methods.
- Execute Trounce Script file using WSL
- Execute Vanquish Script using Ubuntu on Windows 10
i] Execute Shell Script file using WSL
Install WSL or Windows Subsystem for Linux
Go to Settings > Update & Security > For Developers. Check theProgrammer Mode radio push button. And search for "Windows Features", choose "Plough Windows features on or off".
Scroll to find WSL, check the box, and then install it. Once done, i has to reboot to finish installing the requested changes. Press Restart now. Bash will be available in the Command Prompt and PowerShell.
Execute Shell Script Files
- Open Command Prompt and navigate to the folder where the script file is available.
- Type Bash script-filename.sh and hit the enter primal.
- It will execute the script, and depending on the file, you should see an output.
On a Linux platform, you lot usually utilize SH, simply hither you demand to use BASH. That said, Bash in Windows has its limitations, so if you want to execute in a Linux environs, you need to install Ubuntu or anything similar.
two] Execute Shell Script using Ubuntu on Windows x
Make sure you take Ubuntu or any other Linux distros installed. Ubuntu volition mount or make all your Windows directories available under /mnt. And so the C bulldoze is available at /mnt/C. So if the desktop will be available at /mnt/c/users/<username>/desktop.
Now follow these steps
- Type Fustigate in run prompt, and it will launch the distro prompt.
- Navigate to the folder using "cd" control to the binder where the scripts are bachelor.
- Blazon "sh script.sh" and hit enter.
Information technology will execute the script, and if they have a dependency on any of core Linux features.
Since Linux is now bachelor in Windows, you need not use any 3rd political party applications like Cygwin. WSL should be enough for most of the scenarios to help you run a shell script in Windows 10.
How To Run A Script In Windows Command Prompt,
Source: https://www.thewindowsclub.com/how-to-run-sh-or-shell-script-file-in-windows-10
Posted by: lemenmaress61.blogspot.com

0 Response to "How To Run A Script In Windows Command Prompt"
Post a Comment