How do I locate and "re-target" a shortcut (.lnk)

I need to write a C# method that will find and "re-target" all shortcuts (eg  .lnk files) that point to a specific target.  I've found some WSH (windows scripting host) examples of creating shortcuts, but I can't seem to find anything that will locate all shortcuts that point to a specific target.

Who is Participating?
_TAD_Connect With a Mentor Commented:

Here is a quick utility to get all of the file pathways with an *.lnk extension.

            private void button1_Click(object sender, System.EventArgs e)
                  ArrayList mylist = GetFiles(@"C:\Documents and Settings","*.lnk",new ArrayList());
                  FileInfo f;

                  for(int i=0;i<mylist.Count;i++)


            private ArrayList GetFiles(string path, string fileType, ArrayList fileList)
                  string[] childDirectories;
                  string[] files;
                  // find all dlls in the parent and child directories
                  files = Directory.GetFileSystemEntries(path, fileType);
                  for(int i=0;i<files.Length;i++)

                  // load an array list with all of the valid plug-ins
                  childDirectories = Directory.GetDirectories(path);
                  for(int i=0;i<childDirectories.Length;i++)
                        fileList = GetFiles(childDirectories[i], fileType, fileList);

                  return fileList;

But as far as changing the contents of those files... I think you'll need to use WIN API for that.   As far as I know, .NET cannot change the properties of shortcut links.  .Net only manipulates actual files... not the links to files.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.