Click here to Skip to main content
15,903,175 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How can I find invalid shortcuts which have a bad link?
Posted
Updated 12-Nov-10 2:16am
v2

Hi!

You might want to try this:
// reference %systemroot%\system32\shell32.dll
// that will generate an interop wrapper
Shell32.ShellClass Shell = new Shell32.ShellClass();
Shell32.Folder folder = Shell.NameSpace(@"./SomePath");
Shell32.FolderItem file = folder.Items().Item("nameofshortcut.lnk");
Shell32.ShellLinkObject link = (Shell32.ShellLinkObject)file.GetLink;

string Link_Path = link.Path;
if(!File.Exists(LinkPath)
{
    //Do something appropriate here
}


Cheers

Manfred
 
Share this answer
 
Comments
Dalek Dave 12-Nov-10 9:45am    
Good Call.
<big><small><a href=""></a> ;P  :(  :(  :((  :((  :((  :((  :((  :omg: :confused::confused::rose::rose::thumbsdown::thumbsup::thumbsup::mad::mad:</small></big>
:(( :(( :sigh: ;P :laugh: :) :) :-D ;) :( :doh: :rolleyes: :~:suss::rose::thumbsdown::thumbsdown::thumbsdown::thumbsdown::thumbsdown::thumbsdown::thumbsup::thumbsup::cool: X| :suss::~:mad::~:suss::thumbsdown::thumbsdown::thumbsup:
 
Share this answer
 
Comments
Slacker007 15-Nov-10 11:18am    
High on crack?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900