FileGetShortcut

ショートカット(.lnk)ファイルの対象ファイルなどの情報を取得します。

FileGetShortcut LinkFile , &OutTarget, &OutDir, &OutArgs, &OutDescription, &OutIcon, &OutIconNum, &OutRunState

パラメータ

LinkFile

型:文字列

解析するショートカットファイルの名前。絶対パスが指定されていない場合は、A_WorkingDirにあると仮定されます。必ず拡張子.lnkを付けてください。

&OutTarget

型:VarRef

省略したときは、対応する値は保存されません。Otherwise, specify a reference to the output variable in which to store the shortcut's target (not including any arguments it might have). 事例:C:\WINDOWS\system32\notepad.exe

&OutDir

型:VarRef

省略したときは、対応する値は保存されません。Otherwise, specify a reference to the output variable in which to store the shortcut's working directory. 事例:C:\My Documents. If environment variables such as %WinDir% are present in the string, one way to resolve them is via StrReplace. 事例:OutDir := StrReplace(OutDir, "%WinDir%", A_WinDir)

&OutArgs

型:VarRef

省略したときは、対応する値は保存されません。Otherwise, specify a reference to the output variable in which to store the shortcut's parameters (blank if none).

&OutDescription

型:VarRef

省略したときは、対応する値は保存されません。Otherwise, specify a reference to the output variable in which to store the shortcut's comments (blank if none).

&OutIcon

型:VarRef

省略したときは、対応する値は保存されません。Otherwise, specify a reference to the output variable in which to store the filename of the shortcut's icon (blank if none).

&OutIconNum

型:VarRef

省略したときは、対応する値は保存されません。Otherwise, specify a reference to the output variable in which to store the shortcut's icon number within the icon file (blank if none). この値は、多くの場合、1であり、最初のアイコンを意味します。

&OutRunState

型:VarRef

省略したときは、対応する値は保存されません。Otherwise, specify a reference to the output variable in which to store the shortcut's initial launch state, which is one of the following digits:

エラー処理

失敗したときはOSErrorをスローします。

備考

対応する情報が不要な場合は、出力変数のいずれかを省略することができる。

FileCreateShortcut, SplitPath

.lnkファイルを選択し、その情報を表示できるようにします。

LinkFile := FileSelect(32,, "Pick a shortcut to analyze.", "Shortcuts (*.lnk)")
if LinkFile = ""
    return
FileGetShortcut LinkFile, &OutTarget, &OutDir, &OutArgs, &OutDesc, &OutIcon, &OutIconNum, &OutRunState
MsgBox OutTarget "`n" OutDir "`n" OutArgs "`n" OutDesc "`n" OutIcon "`n" OutIconNum "`n" OutRunState