Revision: 40204
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at January 27, 2011 13:58 by kyrathaba
Initial Code
public string GetShortcutTargetFile(string shortcutFilename) {
string pathOnly = System.IO.Path.GetDirectoryName(shortcutFilename);
string filenameOnly = System.IO.Path.GetFileName(shortcutFilename);
Shell32.Shell shell = new Shell32.ShellClass();
Shell32.Folder folder = shell.NameSpace(pathOnly);
Shell32.FolderItem folderItem = folder.ParseName(filenameOnly);
if (folderItem != null) {
Shell32.ShellLinkObject link =
(Shell32.ShellLinkObject)folderItem.GetLink;
return link.Path;
}
return ""; // not found
}
Initial URL
Initial Description
Add a reference to Microsoft Shell Controls and Automation to your project. Then add the method shown below:
Initial Title
Get full path of file a shortcut link references
Initial Tags
Initial Language
C#