Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Getting Dos 8.3 Name
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00704443
Message ID:
00704452
Views:
18
>I'm using Getfile() and getting the long windows file name. Is there any function or a way to get the DOS 8.3 short file name given it's full long file name?
>

You can use the WIndows API function GetShortPathName() as follows:
DECLARE INTEGER GetShortPathName IN WIN32API ;
   STRING @ lpszLongPath, ;
   STRING @ lpszShortPath, ;
   INTEGER cchBuffer

cShortFormBuffer = REPL(CHR(0),512)
nLenShortName = GetShortPathName('MyLongPathName',@cShortFormBuffer,511) 
IF nLenShortName # 0
   cShortName = LEFT(cShortFormBuffer,nLenShortName)
ELSE
   * Call GetLastError() for error code
ENDIF
Or you can use the Scripting.FileSystemObject from the WSH:
oFSO = CREATEOBJ('Scripting.FileSystemObject')
oFile = oFSO.GetFile('MyLongFileName')
? oFile.ShortName
? oFile.ShortPath
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform