Cygpath
Jump to navigation
Jump to search
cygpath is a program in the Cygwin suite that can, among other things, translate Cygwin's POSIX-style file paths into their equivalent Windows- or DOS-style filenames. This makes it possible to hand off Unix filenames (including symlinks) to Windows-native programs.
Using it in a script is a simple matter:
echo The home directory is "$(cygpath -w ~)"
This would print the Windows location of the home directory. When doing this, be sure to enclose the command in quotes; the result of cygpath -w may contain spaces.
If you need the DOS filename (e.g., "C:\PROGRA~1" instead of "C:\Program Files"), use cygpath -d.