Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Git for windows "git bash", how to "print working directory" in Windows path format that is usable by cmd and Windows explorer?

Tags:

When using Git for Windows "git bash" on Windows, how to conveniently print the working directory in Windows path representation, e.g.

D:\foo\bar 

similar to using 'pwd' to get the Unix representation

/d/foo/bar/ 

such that the path can be read by Windows explorer and cmd console?

like image 502
yhd.leung Avatar asked Jun 30 '17 08:06

yhd.leung


People also ask

How do I get the current directory in git bash?

The Bash command pwd is used to print the 'present working directory'. pwd is equivalent to executing cd on a DOS(Windows console host) terminal. This is the folder or path that the current Bash session resides in. The Bash command ls is used to 'list' contents of the current working directory.

How do I change directory in git using CMD?

To change this current working directory, you can use the "cd" command (where "cd" stands for "change directory"). For example, to move one directory upwards (into the current folder's parent folder), you can just call: $ cd ..

Does git bash use Windows path?

You need to change this Windows CMD to Git Bash. Go to File > Preferences > Settings and type shell in search settings. After that, navigate to Terminal > Integrated > Shell:Windows and update the path with Git Bash executable: C:\Program Files\Git\bin\bash.exe and save.


1 Answers

In Git Bash:

$ cmd //c cd C:\Program Files\Git 

Note the double slash. And for forward slashes, as mentioned in the comments:

$ pwd -W C:/Program Files/Git 
like image 98
vestlen Avatar answered Oct 20 '22 12:10

vestlen