By using this site, you agree to the Privacy Policy.
Accept
EnterinITEnterinITEnterinIT
  • HOME
  • IT PRO
  • TECH
  • MICROSOFT
    • Azure
    • ConfigMgr/SCCM
    • DPM
    • Orchestrator
    • Hyper-V
    • Microsoft Edge Insider
    • MSI
    • Office 365
    • Office Insider
    • Power BI
    • Skype
    • SQL Server
    • Teams
  • WINDOWS
    • Windows Admin Center
    • Windows Client
    • Windows Server
  • SCCM Query Collection List
Reading: How to Execute Shell Script Files on Windows 10 Using WSL
Font ResizerAa
EnterinITEnterinIT
Font ResizerAa
  • HOME
  • IT PRO
  • TECH
  • MICROSOFT
  • WINDOWS
  • SCCM Query Collection List
Search
  • HOME
  • IT PRO
  • TECH
  • MICROSOFT
    • Azure
    • ConfigMgr/SCCM
    • DPM
    • Orchestrator
    • Hyper-V
    • Microsoft Edge Insider
    • MSI
    • Office 365
    • Office Insider
    • Power BI
    • Skype
    • SQL Server
    • Teams
  • WINDOWS
    • Windows Admin Center
    • Windows Client
    • Windows Server
  • SCCM Query Collection List
Windows Client

How to Execute Shell Script Files on Windows 10 Using WSL

Published: February 18, 2024
2 Min Read
SHARE

How to Execute Shell Script Files on Windows 10 Using WSL.

Contents
Execute Shell Script file using WSLInstall WSL or Windows Subsystem for LinuxExecute Shell Script FilesExecute Shell Script using Ubuntu in dual-boot

Bash is a Unix shell and command language which can run Shell Script files.

  1. Execute Shell Script file using WSL
  2. Execute Shell Script using Ubuntu on Windows 10

Execute Shell Script file using WSL

Install WSL or Windows Subsystem for Linux

1. Go to Settings\Update & Security\For Developers. Check the Developer Mode;

2. Search for Windows Feature, and choose to Turn Windows features on or off;

3. Scroll to find WSL, check the box, and then install it;

4. Reboot to finish installing the requested changes;

5. BASH will be available in the Command Prompt and PowerShell.

Execute Shell Script Files

1. Open Windows PowerShell and navigate to the folder where the script file is available;

2. Type:

Bash script-filename.sh

It will execute the script, and depending on the file, you should see an output.

On a Linux platform, you usually use SH, but here you need to use BASH.

Execute Shell Script using Ubuntu in dual-boot

Make sure you have Ubuntu or any other Linux distros installed on the target PC in dual-boot with Windows 10. Ubuntu will mount or make all your Windows directories available under /mnt. So the C:\ drive is available at /mnt/C.

Now follow these steps:

  1. Type Bash in a run prompt, and it will launch the distro prompt.
  2. Navigate to the folder using the cd command to the folder where the scripts are available.
  3. Type sh script.sh and hit enter.
TAGGED:Command Prompt (CMD)LinuxPowerShellUbuntuWindowsWindows 10WSL
Previous Article How to Fix “Failed to Open the Runspace Pool” Error in Server Manager WinRM Plug-in?
Next Article How to Change Virtual Memory Size on Windows 10: Step-by-Step Guide
1 Comment 1 Comment
  • awda says:
    August 19, 2020 at 1:36 pm

    This is false, to use bash like this you NEED to have linux distribution installed

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Translation

English中文(简体)DanskNederlandsFrançaisDeutschItaliano한국어PolskiPortuguêsRomânăEspañolУкраїнська
by Transposh - translation plugin for wordpress

Popular Posts

System Requirements for Windows Server 2016
Windows Server
Configuration Manager Query Collection List
Configuration Manager Query Collection List
ConfigMgr
Structured/Managed Navigation enabled on Modern Pages in Classic Team Sites
Tech
SCCM Failed to get DP locations as the expected version from MP
ConfigMgr

Recent Posts

Installing and Configuring Fail2ban for SSH Protection on Ubuntu 24.04
Linux
Enabling and Configuring FirewallD on AlmaLinux
Linux
User Creation and SSH Key Setup in AlmaLinux
Linux
How to reset password on AlmaLinux
Linux

© 2023 EnterinIT

Go to mobile version
Welcome Back!

Sign in to your account

Username or Email Address
Password

Lost your password?