Shortcut target

F

Fred

Hi,

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

Thanks,
Fred
 
O

Onur Güzel

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
 
F

Fred

Thanks Onur and Herfried.


Onur Güzel said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top