I have installed cygwin on Windows 11. Now, when I open the Windows command line, I want the bash.exe command to run the cygwin's bash command instead of bash linked with wsl (Windows subsystem for Linux). In other words, when I run bash.exe I don't want to see the "Windows Subsystem for Linux has no installed distributions." message, but instead run bash from my cygwin installation. I have tried adding the cygwin's "bin" directory to the Windows PATH environment variable, but with no effect.


Originally, I wrote that adding the cygwin's "bin" folder path to the Windows PATH environment variable had no effect, and while it is true for running bash-exe from the Windows cmd shell, it has meanwhile actually solved the problem of running bash.exe from the Python script, which in reality was my problem. I thought that running the command behaved equally no matter whether run from the cmd shell or Python script, but obviously there is a difference.

  • I have tried adding the cygwin's "bin" directory to the Windows PATH environment variable, but with no effect but where did you put it? At the beginning? At the end? The order of the paths is important
    – phuclv
    Jul 23 at 2:30
  • I've put it in the beginning. It has no effect on cmd shell, but the Python script which runs the bash.exe command now runs cygwin without an issue.
    – Adam
    Jul 24 at 13:18
  • I have tried adding the cygwin's "bin" directory to the Windows PATH : This was basically a good idea, but did you actulally verify afterwards from the command line, that the PATH is correct? In a Batch command line, you do this by simply typing path without any argument. Don't know about Powershell (but perhaps echo %PATH% should do). Jul 25 at 7:32

1 Answer 1


When you say "command line", I'm going to assume you mean the CMD shell, although you could potentially mean PowerShell.

For CMD, the easiest way to do this is probably with a doskey alias for bash:

doskey bash=D:\cygwin\bin\bash.exe $*

To make this permanent, see this answer.

For PowerShell, use the New-Alias equivalent and set it in your PowerShell profile.

Other options:

Windows Terminal

However, you may want to consider two other tools to make this even (IMHO) easier:

Both of these are Microsoft products and installable from the Microsoft Store.

You can set up a Cygin profile in Windows Terminal named "Bash", and using PowerToys run, activate it via _Bash. The prefix for any Terminal profile is _, but you can even skip that if you use it often. Power Run will sort it to the top based on usage.

I recommend turning on the option Open profiles in a new tab in PowerToys Run's "Windows Terminal" settings.

Adjust path

You could adjust your path, but you'll need to do that in the current CMD or PowerShell session, so you'd still need a startup CMD script or PowerShell profile. Given that, I think the Alias approach is probably better.

  • Thanks. Actuallly, the 'bash.exe' command was used in some Python script which I cannot modify, not in cmd. However, looks like adding the path to the cygwin's bin folder to PATH in Windows solved the problem.
    – Adam
    Jul 23 at 9:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.