How we can find target of a shortcut file

vikasbapat
vikasbapat used Ask the Experts™
on
How we can find a path of target folder whose shortcut is created?
i got path of .lnk file but from this how can i find a path of target folder?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Rahul Goel ITILSenior Consultant - Deloitte

Commented:

using System; 
using IWshRuntimeLibrary; 
 
namespace DemoForVikas
{ 
class Program 
{ 
static void Main() 
{ 
string linkPathName = @"c:\SomeShortcutFile.lnk"; 
WshShell shell = new WshShell(); 
IWshShortcut link = (IWshShortcut)shell.CreateShortcut(linkPathName); 
Console.WriteLine("Target path is {0}",link.TargetPath); 
Console.WriteLine("Working directory is {0}",link.WorkingDirectory); 
Console.ReadLine(); 
} 
} 
} 

Open in new window

Author

Commented:
Thanks i  will try this example.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial