Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 844
Erdem Ece Avatar asked Nov 17 '14 11:11

Erdem Ece


People also ask

How to open Cygwin from a specific directory using Bash?

You are now able to open cygwin in specific directory with a Right mouse click in Windows Explorer (Context Menu) and select "Bash Prompt Here". You can also open cygwin from a specific directory using windows command prompt: This command will open cygwin with current directory taken from command prompt.

What is my Cygwin home directory?

All Windows users on your system should have a home directory with a Windows path of: c:\cygwin\home\[Windows Username] To find out what your home directory name is type the 'pwd' (i.e. print working directory) command in a newly opened Cygwin Console.

How do I create a text file in Cygwin?

For example, if you need to create a file in the following Cygwin directory: and click 'File>New>Text Document' in Windows Explorer to create an empty file. Then use Windows Wordpad to edit it, by doubling-clicking the new file, and selecting WordPad from the 'Open With ...' selection window.

How do I open Cygwin terminal in Windows 10?

Add Cygwin Path to Windows Environment Variable. After the installation you will have a Cygwin icon on your desktop that you can launch to open the Cygwin terminal. This terminal starts in the C:Cygwinhome<user> folder but that isn’t particularly useful because you probably don’t have any files stored there.


3 Answers

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\.

like image 178
Mike Avatar answered Sep 19 '22 02:09

Mike


For whome the above way ain't work anymore, like in PhpStorm v. 2016.3. The shell path have to be enclosed in quotes

"C:\Users\MyUser\.babun\cygwin\bin\env.exe" CHERE_INVOKING=1 /bin/zsh.exe
like image 20
StalkAlex Avatar answered Sep 23 '22 02:09

StalkAlex


For the PhpStorm that I'am using (v10.0.4) in Windows 10 I use this command works:

D:\tools\.babun\cygwin\bin\env.exe CHERE_INVOKING=1 /bin/bash.exe

I'm using Babun which installs the Cygwin in D:\tools\.babun\cygwin.

like image 37
numediaweb Avatar answered Sep 19 '22 02:09

numediaweb