Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to convert long file name in Dos 8 chr...
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00359227
Message ID:
00359253
Vues:
14
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform