Shared Function GetShortPathName_CreateDestroy(ByVal Path As String) As String
Dim fCreate As Boolean = Not System.IO.File.Exists(Path)
If fCreate Then System.IO.File.Create(Path).Dispose()
Dim shortPath As String = GetShortPathName(Path)
If fCreate Then System.IO.File.Delete(Path)
Return shortPath
End Function
Shared Function GetShortPathName(ByVal Path As String) As String
Dim shortPath As New System.Text.StringBuilder(255)
GetShortPathName(Path, shortPath, shortPath.Capacity)
Return shortPath.ToString()
End Function
<System.Runtime.InteropServices.DllImport("kernel32.dll", SetLastError:=True, _
CharSet:=System.Runtime.InteropServices.CharSet.Auto)> _
Private Shared Function GetShortPathName(ByVal Path As String, _
ByVal ShortPath As System.Text.StringBuilder, _
ByVal ShortPathLength As Integer) As Integer
End Function