Jump to content

Recommended Posts

Posted

Howdy...i`ve created this UDF cuz I needed something that returns the short names of a given path in MS-DOS. I made a search on the forum and didn`t find anything related.

So here it is...maybe someone could make some use of it, besides me :).

Func _DOSShortNames($aPath)
    Local $sNameDOS, $cDrive, $strbtw, $fFolders
    $cDrive = StringLeft  ( $aPath, 2 )
    $strbtw = StringRight ( $aPath, StringLen ( $aPath ) - 3)
    $fFolders = StringSplit ( $strbtw, "\");[0]nr of folders [n] folders
    For $i = 1 To $fFolders[0]
        If StringLen ( $fFolders[$i] ) > 8 Then
            If Not StringInStr($fFolders[$i], " ", 0, 1) = 0 Then
                $fFolders[$i] = StringReplace ( $fFolders[$i], " " , "" , 0, 0)
                $fFolders[$i] = StringLeft ( $fFolders[$i], 6 ) & "~1"
            Else
                $fFolders[$i] = StringLeft ( $fFolders[$i], 6 ) & "~1"
            EndIf
        EndIf
        $sNameDOS =$sNameDOS &"\"&$fFolders[$i]
    Next
        Return $cDrive & $sNameDOS
EndFunc

Example:

_DOSShortNames("c:\this\is one of\my folders")

Returns: c:\this\isoneo~1\myfold~1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...