Search code examples
cygwinphpstorm

Open Cygwin command in specified directory on windows


I use phpstorm and it's terminal facility.

In terminal section I typed F:\Projects\cygwin64\bin\mintty.exe -i /Cygwin-Terminal.ico - so it uses Cygwin as terminal. But it opens it in home folder. Is it possible to open it in different folder? By typing a command or by doing something else.

Because I have a folder called F:\Projects\Local in this folder I have vagrant and I want to open phpstorm, open terminal within php storm and just type vagran up. I don't want to open cgywin again.

thanks


Solution

  • If you just want to open Cygwin with Mintty in the project directory then you can execute the command:

    F:\Projects\cygwin64\bin\mintty.exe /bin/env CHERE_INVOKING=1 /bin/bash -l
    

    This will avoid automatically changing to the home directory. See https://code.google.com/p/mintty/wiki/Tips#Starting_in_a_particular_directory for more information on this command.

    If you want to use the embedded PhpStorm terminal, then you can modify the Shell path in the terminal settings. Open File > Settings... > Tools > Terminal. Replace the shell path with F:\Projects\cygwin64\bin\env.exe CHERE_INVOKING=1 /bin/bash -l. You may need to restart PhpStorm after this change.

    Note: this is assuming that your Cygwin Root Directory is F:\Projects\cygwin64\.