Search code examples
windowsgitbashgit-for-windows

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


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?


Solution

  • 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