Inspecting the properties of shortcuts

  • Thread starter Thread starter David Jackson
  • Start date Start date
D

David Jackson

Hello,

I've been asked to write a sort of "desktop clean-up" utility.

Requirements are simple: iterate through the shortcuts (*.lnk files) on the
currently logged-on user's desktop, and delete each link whose TargetPath
property no longer exists.

Iterating through the shortcuts on the desktop is easy enough using
Directory.GetFiles(*.lnk)

I found the following article which explains how to inspect the various
properties of a shortcut:
http://www.codeproject.com/useritems/Starter.asp

This uses COMInterop to inspect the shortcuts.

The author of the article says that he doesn't believe a managed solution is
available for this. Is this true?

I don't really have a problem using COMInterop but I guess I'd prefer to use
a managed solution if possible.

Does anyone know if there is one?

Thanks,

DJ
 
David,

Well, there isn't a native managed wrapper for it if that is what you
mean, or a managed way to parse the files and get the contents.

COM interop is as managed as it is going to get.
 
message
Hi Nicholas,

Thanks for the reply
Well, there isn't a native managed wrapper for it if that is what you
mean, or a managed way to parse the files and get the contents.

COM interop is as managed as it is going to get.

OK.

DJ
 
Back
Top