Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to convert long file name in Dos 8 chr...
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00359227
Message ID:
00359253
Views:
13
>Is there a way to convert long file name and directory in the DOS 8 characters format?
>ex:
>c:\program files\autocad R14 => c:\progra~1\autoca~1

A couple of things, including the WSH, can get this. If it's not installed, then:
DECLARE INTEGER GetShortPathName in win32api;
  STRING @lpsource, STRING @lptarget, INTEGER nLength
lcbuffer = SPACE(260)
* lcfilename is the long filename
lnresult = GetShortPathName(@lcfile, @lcbuffer, LEN(lcbuffer))
IF lnresult > 0
  ? LEFT(lcbuffer, lnresult)
ENDIF
* With the WSH
oFSO = CREATEOBJECT('Scripting.FileSystemObject')
oFile = oFSO.GetFile(lcfile)
IF NOT ISNULL(oFile)
  ? oFile.ShortName
ENDIF
George

Ubi caritas et amor, deus ibi est
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform