cygpath -u doesn't seem to convert spaces properly

Brian Dessent
Tue Sep 25 23:51:00 GMT 2007

Jerome Fong wrote:

> I am trying to use cygpath -u to convert my windows path to an unix path
> in my shell script.  However, it has problems with paths that has spaces
> in it.  For example, "cygpath -u c:\Program Files\Java" is converted to
> /cygdrive/c/Program Files/Java, which doesn't work.  Is there a flag
> that I am missing?

The unix version is correct but still has spaces, which means it still
needs proper quoting.  So if you are doing something like this:

ls $(cygpath -u 'c:\Program Files\Java')

then you are not quoting sufficiently.  However, in your example below
you appear to be using the proper amount of quoting:

> $ cygpath -u "$(cygpath -m -s "c:\Program Files\Java")"
> /cygdrive/c/PROGRA~1/Java

So please give us an example of exactly the command that fails, because
there should never be a need to resort to using the 8.3 short filename
ugliness -- especially since this is an optional NTFS feature that can
be disabled in order to speed things up, which means it's not entirely
portable (not to mention wholly unnecessary as long as proper quoting is


Unsubscribe info:
Problem reports:

More information about the Cygwin mailing list