FileGetShortcut
获取快捷方式的详细资料.
FileGetShortcut ( "lnk" )
参数
lnk
|
快捷方式文件(*.lnk)的完整路径和文件名.
|
返回值
成功:
|
返回快捷方式相关信息的数组. 见备注.
|
失败:
|
设置 @error 为 1, 表示无法访问快捷方式.
|
备注
函数返回含下列元素的一维数组:
$aArray[0] = 快捷方式的目标路径
$aArray[1] = 工作目录
$aArray[2] = 参数
$aArray[3] = 描述
$aArray[4] = 图标文件名
$aArray[5] = 图标索引
$aArray[6] = 快捷方式状态 (@SW_SHOWNORMAL, @SW_SHOWMINNOACTIVE, @SW_SHOWMAXIMIZED)
相关
FileCreateShortcut
函数示例
#include <MsgBoxConstants.au3>
Example()
Func Example()
; Create a constant variable in Local scope of the shortcut filepath.
Local Const $sFilePath = @DesktopDir & "\FileGetShortcutExample.lnk"
; Create a shortcut on the desktop to explorer.exe and set the hotkey combination Ctrl+Alt+T or in AutoIt ^!t to the shortcut.
FileCreateShortcut(@WindowsDir & "\explorer.exe", $sFilePath, @WindowsDir, "/e,c:\", _
"Tooltip description of the shortcut.", @SystemDir & "\shell32.dll", "^!t", "15", @SW_SHOWMINNOACTIVE)
; Retrieve details about the shortcut.
Local $aDetails = FileGetShortcut($sFilePath)
If Not @error Then
MsgBox($MB_SYSTEMMODAL, "", "Path: " & $aDetails[0] & @CRLF & _
"Working directory: " & $aDetails[1] & @CRLF & _
"Arguments: " & $aDetails[2] & @CRLF & _
"Description: " & $aDetails[3] & @CRLF & _
"Icon filename: " & $aDetails[4] & @CRLF & _
"Icon index: " & $aDetails[5] & @CRLF & _
"Shortcut state: " & $aDetails[6] & @CRLF)
EndIf
; Delete the shortcut.
FileDelete($sFilePath)
EndFunc ;==>Example
----------------------------------------
|