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?
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.
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 ..
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With