Entering Cygwin command line (bash login) from Windows cmd.exe ?

Lee ler762@gmail.com
Mon Aug 7 17:39:35 GMT 2023

On 8/7/23, Roland Mainz via Cygwin  wrote:
> On Sat, Jul 29, 2023 at 6:18 AM Roland Mainz  wrote:
>> Is there an official way to enter the Cygwin command line (e.g. bash
>> login) from Windows cmd.exe, e.g. if someone ssh's into a Windows
>> machine he/she ends/up in a cmd.exe and not bash...
> ping!

Years ago this was the default way to start cygwin (I don't think I've
changed it, but who knows??)

C:\cygwin>type Cygwin.bat
@echo off

chdir C:\cygwin\bin

bash --login -i

There's a Cygwin.bat in /etc/defaults that needs to be copied to the
cygwin root directory:

C:\cygwin>type etc\defaults\Cygwin.bat
@echo off
setlocal enableextensions
set TERM=
cd /d "%~dp0bin" && .\bash --login -i


"cd /d" - Use the /D switch to change current drive in addition to
changing current directory for a drive.

"%~dp0" gives the path of the script, so if the .bat file is in
C:\cygwin then "%~dp0bin" expands to C:\cygwin\bin


More information about the Cygwin mailing list