Retrieves details about a shortcut.
FileGetShortcut ( "lnk" )
lnk | Full path and file name of the shortcut. |
Success: | an array that contains the shortcut information. See Remarks. |
Failure: | sets the @error flag to 1 if the shortcut could not be accessed. |
The array returned from this function is a single dimension array containing the following elements:
$aArray[0] = Shortcut target path
$aArray[1] = Working directory
$aArray[2] = Arguments
$aArray[3] = Description
$aArray[4] = Icon filename
$aArray[5] = Icon index
$aArray[6] = The shortcut state (@SW_SHOWNORMAL, @SW_SHOWMINNOACTIVE, @SW_SHOWMAXIMIZED)
#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