将 posix 路径转换为 ​​git bash 中的 windows(终端或脚本)?

Convert a posix path to windows in git bash (terminal or script)?

windows 上的一些 programs/libraries 只需要 windows 路径。所以从 git bash 终端我必须这样做:

$ export FOO="d:\path\to\folder"

有替代方案吗?

我过去曾见过(例如 Git itself) the cygpath command

Convert Unix and Windows format paths, or output system path information

The -u and -w options indicate whether you want a conversion to UNIX (POSIX) format (-u) or to Windows format (-w).


propatience points out in to the example "cygpath -u 'c:\cygwin\cygbuild\build.mak'",使用单引号。