Private Declare Ansi Function GetShortPathName Lib "kernel32" Alias "GetShortPathNameA" (ByVal lpszLongPath As String, _
ByVal lpszShortPath As String, _
ByVal cchBuffer As Integer) As Integer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Const MAX_LENGTH As Integer = 260
Dim longPath As String = Application.ExecutablePath
Dim shortPath As String = New String(" "c, MAX_LENGTH)
Dim length As Integer = GetShortPathName(longPath, shortPath, MAX_LENGTH)
MessageBox.Show(shortPath)
End Sub