如何获取 Cygwin 主目录的 Windows 路径?

How to get the Windows path to Cygwin home directory?

如何以编程方式确定 Windows 格式(例如 C:\cygwin\home\user)的当前 Cygwin 用户主目录,以便我可以在 Cygwin Bash 之外从中读取?

您可以使用 cygpath:

cygpath -w ~

示例输出:

C:\Users\dhaley