Shortcut target

  • Thread starter Thread starter Fred
  • Start date Start date
F

Fred

Hi,

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

Thanks,
Fred
 
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
 
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
 
Back
Top