When are Windows Short Path Names required

Brian Dessent brian@dessent.net
Sat Oct 22 21:18:00 GMT 2005

zzapper wrote:

> $ cygpath -d c:/Program\ Files/Internet\ Explorer
> I've just had another case where the I had to use the short form, is the short form the "real name"?

Huh?  What do you mean?  Does the short form uniquely identify the
file?  Yes, of course.  But only in that particular instance. 
"progra~1" does not necessarily always map to "Program Files".  For
example if you created "Program Data" and then later created "Program
Files", you would have "progra~1" and "progra~2".  So you can not and
should not blindly assume that a certain short name will always map to a
given long name.  It's a one-way thing.  Even storing a short name (such
as in the registry or a config file) and then later referring to that
file is not safe, since the ~1 mapping might have changed.  (Many, many
programs make this mistake still.)

Generation of the short name from the long name is not even not
guaranteed to exist or work.  You can turn off 8.3 filename generation
on NTFS volumes, which means that the short form no longer works.

In other words, 8.3 filenames are a hideous hack that no one should be
using in this day and age.  Fix the quoting problem instead.


Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

More information about the Cygwin mailing list