Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Get ShortPathNames from given LongPathNames
Message
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01413340
Message ID:
01413346
Views:
86
This message has been marked as the solution to the initial question of the thread.
>Hi all
>
>Is it possible to get a ShortPathName for a given Long Path Name?
>
>C:\PROGRA~1\FOLDERN~1\FILE.EXT
>
>from the supplied "C:\Program Files\Folder Name\file.ext"
>
>Thanks and regards.

You can use the GetShortPathName() API function:
* API:
Declare LONG GetShortPathName IN WIN32API STRING, STRING @, LONG
LOCAL lcShortName, lcLongName
lcShortName = REPLICATE(CHR(0),200)
lcLongName = HOME()
? GetShortPathName(m.lcLongName,@lcShortName,199), m.lcShortName
*!*	? FILE( ADDBS(m.lcShortName) + 'vfp9.exe')

* WSH (seems easier but may not always be available):
LOCAL loFS as Scripting.FileSystemObject
loFS = CREATEOBJECT('Scripting.FileSystemObject')
? loFS.GetFolder( HOME() ).ShortPath
hth
-Stefan
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform