From: Fred on
Hi,

Given a shortcut file (*.lnk) I need to find it's Target address.
Can some please help me out.

Thanks,
Fred


From: Herfried K. Wagner [MVP] on
Am 14.04.2010 04:05, schrieb Fred:
> Given a shortcut file (*.lnk) I need to find it's Target address. Can
> some please help me out.

Samples
<URL:http://www.msjogren.net/dotnet/eng/samples/dotnet_shelllink.asp>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
From: Onur Güzel on
On Apr 14, 5:05 am, "Fred" <repl...(a)newsgroup.please> wrote:
> Hi,
>
> Given a shortcut file (*.lnk) I need to find it's Target address.
> Can some please help me out.
>
> Thanks,
> Fred

Add a reference to "Windows Script Host Object Model" through COM tab
in "Add Reference" dialog.

Then pass the necessary .lnk location to find its target path as
follows:

'-------------------------
Start------------------------------------------------------
Dim shortCut As IWshRuntimeLibrary.IWshShortcut
shortCut = CType((New IWshRuntimeLibrary.WshShell).CreateShortcut _
("c:\shortcut_here.lnk"), _
IWshRuntimeLibrary.IWshShortcut)

' Get target path in messagebox
MsgBox(shortCut.TargetPath)
'-------------------------
End------------------------------------------------------

HTH,

Onur Güzel
From: Fred on
Thanks Onur and Herfried.


"Onur G�zel" <kimiraikkonen85(a)gmail.com> wrote in message
news:142c029e-34f4-43fd-8abe-c44770de57c6(a)c36g2000yqm.googlegroups.com...
> On Apr 14, 5:05 am, "Fred" <repl...(a)newsgroup.please> wrote:
>> Hi,
>>
>> Given a shortcut file (*.lnk) I need to find it's Target address.
>> Can some please help me out.
>>
>> Thanks,
>> Fred
>
> Add a reference to "Windows Script Host Object Model" through COM tab
> in "Add Reference" dialog.
>
> Then pass the necessary .lnk location to find its target path as
> follows:
>
> '-------------------------
> Start------------------------------------------------------
> Dim shortCut As IWshRuntimeLibrary.IWshShortcut
> shortCut = CType((New IWshRuntimeLibrary.WshShell).CreateShortcut _
> ("c:\shortcut_here.lnk"), _
> IWshRuntimeLibrary.IWshShortcut)
>
> ' Get target path in messagebox
> MsgBox(shortCut.TargetPath)
> '-------------------------
> End------------------------------------------------------
>
> HTH,
>
> Onur G�zel