Private Declare Function GetShortPathName Lib "kernel32" Alias "GetShortPathNameA" (ByVal longPath As String, ByVal shortPath As String, ByVal shortBufferSize As Int32) As Int32 Dim ShortFileName = Microsoft.VisualBasic.Space(260) GetShortPathName("C:\program files", ShortFileName, Len(ShortFileName)) Dim pos1 = InStr(1, ShortFileName, Chr(0)) If pos1 > 0 Then ShortFileName = Mid(ShortFileName, 1, pos1 - 1) End If