How to get the real target of a shortcut?

Heiko 1,211 Reputation points

I have a shortcut on the desktop, that opens Adobe Reader XI, in the following path:

C:\Users\Heiko\Desktop\Adobe Reader XI.lnk

In my app, I am trying to get the destinations of various shortcuts. However, with Adobe Reader XI, I only get an ico file as a target. When I look at the properties of the shortcut on the desktop, the target field is locked and the name of the app is shown in it.


However, if I start the lnk file with Process.Start(), a process is started with C:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe.

// Add Reference to 'Microsoft Shell Controls And Automation' from COM area.

Shell32.Shell shell = new Shell32.Shell();

Shell32.Folder folder = shell.NameSpace(@"C:\Users\Heiko\Desktop");

foreach (Shell32.FolderItem item in folder.Items())
	if (item.IsLink)
		Shell32.ShellLinkObject lnk = item.GetLink;

		Shell32.FolderItem target = lnk.Target;
		string path = target.Path;	// path: C:\Windows\Installer\{AC76BA86-7AD7-1031-7B44-AB0000000001}\SC_Reader.ico

target.Path contains the ico file, although AcroRd32.exe is started. Is there any way to find out if there is a target other than lnk.Target.Path behind the shortcut?

Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,667 questions
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,208 questions
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,521 questions
{count} votes

Accepted answer
  1. Castorix31 81,466 Reputation points

1 additional answer

Sort by: Most helpful
  1. RLWA32 40,271 Reputation points

    From the description it sounds like the shortcut on the desktop is what is known as an "advertised" shortcut created by the Windows Installer. Raymond Chen's blog at Why do some shortcuts not support editing the command line and other properties? explains that "Shortcuts to advertise applications and shortcuts to items in the Games folder are not shortcuts to executables. They are shortcuts into the shell namespace for various types of virtual data. An advertised application is a shell namespace object that represents “an installed application”. It is not a pointer directly to the executable, but rather a reference to an entry in the MSI database, which in turn contains information about how to install the program, repair it, update it, and run it. The shell doesn’t even know what the command line is. To launch an advertised shortcut, the shell asks the MSI database for the command line, and it then executes that command line that MSI returns."