就是直接艹lnk的文件结构罢了。
Private Declare Sub GetMem2 Lib "msvbvm60" (ByVal Ptr As Long,RetVal As Integer) Private Declare Sub GetMem4 Lib "msvbvm60" (ByVal Ptr As Long,RetVal As Long) Private Declare Sub MoveMemory Lib "msvbvm60" Alias "__vbaCopyBytesZero" (ByVal Length As Long,ByVal Dst As Long,ByVal Src As Long) Private Declare Function lstrlenA& Lib "kernel32" (ByVal lpString&) Private Function QueryShortcutFilePath$(ByVal lnkFile$) Dim pFlag&,pFileInfo&,pFilePath&,pSHHeadLength%,strFilePath$,lpBuffer() As Byte Open lnkFile For Binary Access Read As #1 ReDim lpBuffer(LOF(1) - 1) Get #1,lpBuffer Close #1 GetMem4 VarPtr(lpBuffer(0)),pFlag If pFlag = &H4C Then GetMem2 VarPtr(lpBuffer(76)),pSHHeadLength pFileInfo = &H4C + pSHHeadLength + 2 If lpBuffer(pFileInfo + 8) = 1 Then '//local file If lpBuffer(pFileInfo + 40) = 16 Then '//test ok pFilePath = pFileInfo + 44 pFilePath = pFilePath + lstrlenA(VarPtr(lpBuffer(pFilePath))) + 1 '// jump volume label If lstrlenA(VarPtr(lpBuffer(pFilePath))) > 0 Then strFilePath = Space$(260) MoveMemory lstrlenA(VarPtr(lpBuffer(pFilePath))) + 1,StrPtr(strFilePath),VarPtr(lpBuffer(pFilePath)) strFilePath = LeftB$(strFilePath,lstrlenA(StrPtr(strFilePath))) QueryShortcutFilePath = StrConv(strFilePath,vbUnicode) End If End If End If End If End Function Private Sub Form_Load() Dim strCmd$ strCmd = Replace$(Command$,Chr$(34),vbNullString) Me.Caption = QueryShortcutFilePath(strCmd) End Sub