Shortcut target path

I needed to find out the target path of a windows shortcut. So I used a GetOpenFolderItem and surprise, the reported path was the target, and not the actual lnk file. But when I looked at the path reported by obj.folderitem upon dropping a file over my app, I got the path to the shortcut file.

Finally, I realized what to do :

dim f as folderitem = getfolderitem(obj.FolderItem.shellpath) msgbox f.ShellPath //Target path

I am posting this so anybody who needs the same will find it. It is much, much easier than all methods in VS :slight_smile:

Use GetTrueFolderItem.

No, the name is misleading. Instead of resolving the shortcut, it points to it. I believe it is necessary for Mac, where otherwise the system will automatically follow the target when passed an alias.

In Windows, if you want the target path and not the .lnk one, you got to do what I describe, or use WindowsShortcutMBS…

I totally misread your intent. But I’m baffled by what you report.

GetFolderItem resolves the link and returns the target.
GetTrueFolderItem returns the link itself.

It sounds like you got something different?

[quote=132192:@Tim Hare]I totally misread your intent. But I’m baffled by what you report.

GetFolderItem resolves the link and returns the target.
GetTrueFolderItem returns the link itself.

It sounds like you got something different?[/quote]

On Windows 8.1 Obj.Folderitem from the DropObject event does not resolve the target. Hence the need to go through GetFolderItem to get the target path.