In MSYS Bash I get:
$ cd ~
$ pwd
/c/Users/antonio
but:
$ cd /
$ pwd
/
Can I get the full Windows absolute path from Bash?
In recent versions, e.g. MSYS2, you can use:
~$ cygpath -w /
C:\path\to\root
or with a mixed path style:
~$ cygpath -m /
C:/path/to/root
Similarly, you might use:
~$ cygpath -w ~
C:\path\to\home
~$ cygpath -m ~
C:/path/to/home
cmd.exe //c echo ~
(mixed path style) and let| sed 's|/|\\|g'
convert it to windows path if necessary. If you don''t want to use a windows binary and sub-"shell" thenyou may repolace it by{ pushd ~ 1>/dev/null && pwd -W && popd 1>/dev/null ; }
- but that only works for existing folders not for files or non-existing folders