Parse shortcuts (LNK files)?

C

Cross

Is there anyone who knows how to parse a windows shortcut (lnk file) on the
start menu? How hard could it be, it is just a few values, like Target file,
Icon file...
I search for in on Internet for a while, but I did not found anything.

So what I want is the sourse code for a shortcut parser, written in VB.net
if possible (C# would be ok), or at least the specification for how a
shortcut (LNK file) is build, so I can writ one myself.

Thanks in advance
 
M

Matthias Tacke

Cross said:
Is there anyone who knows how to parse a windows shortcut (lnk file) on the
start menu? How hard could it be, it is just a few values, like Target file,
Icon file...
I search for in on Internet for a while, but I did not found anything.

So what I want is the sourse code for a shortcut parser, written in VB.net
if possible (C# would be ok), or at least the specification for how a
shortcut (LNK file) is build, so I can writ one myself.
Google is your friend ;-)
<http://www.google.com/search?q=lnk+file+format>
The first result here is:
<http://mediasrv.ns.ac.yu/extra/fileformat/windows/lnk/shortcut.pdf>

Here is a script to create a lnk file on the desktop:
<http://www.knowdotnet.com/articles/createshortcutondesktop.html>

Instead of "Desktop" the Specialfolder is "Startmenu" in the line

CType(WshShell.SpecialFolders.Item("Desktop"), String)

HTH
 
C

Cross

Thank you really.
I tried with google, but I must have picked the wong search criteria.
 
C

Cor Ligthert [MVP]

I like it forever to show the first and last help I got from Herfried, and
one of the main reasons I am active in this newsgroup.

\\\
AxWebBrowser.Navigate("about:<html><body
onload=javascript:window.external.addFavorite('" + textbox1.Text +
"')></body></html>")
///

You never know how it helps you, I am not so sure about what you are asking.

Cor
 
J

JR

i do it this way.
in vb or vb.net and higher you must leave the 'wshshell' variable.
the example came from script
the control of your dir exist must be changed into a dirinfo

Sub Make_Start_Snelkoppeling()
Dim OS, Link, User, fso, folder
Set WshShell = CreateObject("WScript.Shell")
strstartup = WshShell.specialfolders("Programs") & "\StartUp"

Set fso = CreateObject("Scripting.FileSystemObject")
folder = strstartup
If Not (fso.FolderExists(folder)) Then
fso.createfolder (folder)
End If
Set OS = CreateObject("WScript.Shell")

'new macros
Set Link = WshShell.CreateShortCut(strstartup & "\Some name.lnk")
Link.Description = "Your description"
Link.Hotkey = "Ctrl+Alt+n"
Link.iconlocation = "C:\WINNT\system32\moricons.dll, 91"
Link.targetpath = "C:\WINNT\system32\CMD.EXE"
Link.windowstyle = 7
Link.workingDirectory = "C:\"
Link.Save
end sub
 

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