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

deo*_*oll 5 windows git-bash

Windows 上的一些程序/库需要仅限 Windows 的路径。所以从 git bash 终端我必须这样做:

$ export FOO="d:\\path\\to\\folder"
Run Code Online (Sandbox Code Playgroud)

有替代方案吗?

Von*_*onC 8

我过去见过(例如Git 本身)使用过该cygpath命令

转换Unix和Windows格式路径,或输出系统路径信息

和选项指示是否要转换为 UNIX (POSIX) 格式 ( -u)还是 Windows 格式 ( )。-w-u-w


适应性在示例“”的注释中指出cygpath -u 'c:\cygwin\cygbuild\build.mak',使用单引号。