Option Explicit
Private Declare Function GetShortPathName Lib "kernel32" Alias "GetShortPathNameA" (ByVal lpszLongPath As String, ByVal lpszShortPath As String, ByVal cchBuffer As Long) As Long
Private Sub Command1_Click()
Dim StrCommand As String
StrCommand = GetShortPath("C:\Program Files\装机人员工具\C盘转换为NTFS格式.cmd")
'result = Shell(StrCommand, vbHide)
End Sub
Public Function GetShortPath(strFileName As String) As String
Dim lngRes As Long, strPath As String
'创建存储路径的缓冲区
strPath = String$(165, 0)
'获得一个短文件(路径)名
lngRes = GetShortPathName(strFileName, strPath, 164)
'清除建立缓冲区时多余的 chr$(0)
lngRes = InStr(1, strPath, Chr$(0))
GetShortPath = Mid(strPath, 1, lngRes - 1)
End Function