win32+popen4

Thomas Heller theller at python.net
Fri Mar 1 07:54:28 EST 2002


"Robin Becker" <robin at jessikat.fsnet.co.uk> wrote in message news:gS1JDJAdy2f8EwUF at jessikat.demon.co.uk...
> In article <3C7F6765.94A82394 at engcorp.com>, Peter Hansen
> <peter at engcorp.com> writes
> .....
> >
> >I'm pretty sure the last time I checked the PROGRA~1 convention still
> >worked on WinNT.  Are you sure this doesn't work on Win2K as well?
> >They're supposed to be the same thing, no?
> >
> >-Peter
> I'm sure it does and I guess that Program Files will always match as
> it's often the first. On the other hand working with a path name
> obtained from an execution path there's no guarantee I can always do the
> correct conversion by assuming ~1, some end up as ~2 etc.
>
> Is there a proper way to get the 8.3 name?

>>> import win32api
>>> win32api.FindFiles(r"c:\Program Files")
[(49, <PyTime:10/5/2000 9:34:56 AM>, <PyTime:3/1/2002 12:42:28 PM>, <PyTime:2/26/2002 3:38:17 PM>, 0, 0, 100, 1244528, '
Program Files', 'PROGRA~1')]
>>> win32api.FindFiles(r"c:\Program Files")[0][-1]
'PROGRA~1'

Thomas





More information about the Python-list mailing list