How can I make a Windows shortcut that launches Bash and runs commands?



Windows operating systems, such as Windows 10, have built-in support for the Bash shell, allowing users to run Linux commands from the comfort of their desktop. This opens up a world of possibilities, from scripting and automation to running popular Linux applications natively on Windows.

However, launching the Bash shell and running commands from the command-line can be a bit of a hassle. Fortunately, with a little bit of work, it is possible to create a shortcut that will launch Bash and execute a set of commands with a single click.

The first step is to create a shortcut to launch Bash. This can be done by right-clicking on the desktop and selecting “New -> Shortcut” from the context menu. In the “Type the location of the item” field, enter the following command:

C:\\Windows\\System32\\bash.exe

This will create a shortcut to the Bash shell. You can then customize the shortcut by right-clicking on it, selecting “Properties”, and entering a name, icon, and other settings.

The next step is to configure the shortcut to run commands when it is launched. To do this, right-click on the shortcut and select “Properties”. In the “Target” field, add the command(s) you wish to execute after the existing command. For example, if you wanted to launch Bash and run the command “ls”, the “Target” field would look something like this:

C:\\Windows\\System32\\bash.exe -c \ls\

You can also specify a full path to the command if it is not in the current directory. For example, if you wanted to execute the command “/usr/bin/ls”, the “Target” field would look like this:

C:\\Windows\\System32\\bash.exe -c \/usr/bin/ls\

Once you have configured the shortcut, you can simply double-click on it to launch Bash and execute the specified command(s).

Creating a shortcut to launch Bash and run commands can be a great time-saver for anyone who frequently needs to execute the same set of commands. With a few simple steps, you can create a shortcut that will make it quick and easy to launch Bash and run commands with a single click.

Inquire Now

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
Find your next full or part-time role here

ScaleDesk can either help you find your next full time gig or a part time side gig where you can create extra income!

Onboard with us once
Skip HR screening and go to the final interview with with only your resume and a video interview you never have to redo
Get paid electronically every month for the hours you work
We will be your reference even if you work for us once

IT Teams: Use ScaleDesk to augment your team

Schedule Demo