473,785 Members | 2,219 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Parse shortcuts (LNK files)?

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
Apr 21 '07 #1
6 9294
Cross wrote:
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+fi le+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/createshortcuto ndesktop.html>

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

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

HTH

--
Greetings
Matthias
Apr 21 '07 #2
Thank you really.
I tried with google, but I must have picked the wong search criteria.

"Matthias Tacke" <Ma******@Tacke .dewrote in message
news:f0******** **@news.albasan i.net...
Cross wrote:
>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+fi le+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/createshortcuto ndesktop.html>

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

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

HTH

--
Greetings
Matthias

Apr 21 '07 #3
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.Na vigate("about:< html><body
onload=javascri pt:window.exter nal.addFavorite ('" + textbox1.Text +
"')></body></html>")
///

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

Cor

"Cross" <cr*********@ga wab.comschreef in bericht
news:uU******** ******@TK2MSFTN GP04.phx.gbl...
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

Apr 22 '07 #4
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_Snel koppeling()
Dim OS, Link, User, fso, folder
Set WshShell = CreateObject("W Script.Shell")
strstartup = WshShell.specia lfolders("Progr ams") & "\StartUp"

Set fso = CreateObject("S cripting.FileSy stemObject")
folder = strstartup
If Not (fso.FolderExis ts(folder)) Then
fso.createfolde r (folder)
End If
Set OS = CreateObject("W Script.Shell")

'new macros
Set Link = WshShell.Create ShortCut(strsta rtup & "\Some name.lnk")
Link.Descriptio n = "Your description"
Link.Hotkey = "Ctrl+Alt+n "
Link.iconlocati on = "C:\WINNT\syste m32\moricons.dl l, 91"
Link.targetpath = "C:\WINNT\syste m32\CMD.EXE"
Link.windowstyl e = 7
Link.workingDir ectory = "C:\"
Link.Save
end sub

"Cor Ligthert [MVP]" <no************ @planet.nlschre ef in bericht
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
>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.Na vigate("about:< html><body
onload=javascri pt:window.exter nal.addFavorite ('" + textbox1.Text +
"')></body></html>")
///

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

Cor

"Cross" <cr*********@ga wab.comschreef in bericht
news:uU******** ******@TK2MSFTN GP04.phx.gbl...
>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


Apr 23 '07 #5
Jr,

I think that you will be happy with this more by the time way. It covers in
my idea even more.

http://www.vb-tips.com/dbpages.aspx?...b-23cab5aa1049

Cor

"JR" <x.*@x.xschre ef in bericht
news:Ii******** *************@p hobos.telenet-ops.be...
>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_Snel koppeling()
Dim OS, Link, User, fso, folder
Set WshShell = CreateObject("W Script.Shell")
strstartup = WshShell.specia lfolders("Progr ams") & "\StartUp"

Set fso = CreateObject("S cripting.FileSy stemObject")
folder = strstartup
If Not (fso.FolderExis ts(folder)) Then
fso.createfolde r (folder)
End If
Set OS = CreateObject("W Script.Shell")

'new macros
Set Link = WshShell.Create ShortCut(strsta rtup & "\Some name.lnk")
Link.Descriptio n = "Your description"
Link.Hotkey = "Ctrl+Alt+n "
Link.iconlocati on = "C:\WINNT\syste m32\moricons.dl l, 91"
Link.targetpath = "C:\WINNT\syste m32\CMD.EXE"
Link.windowstyl e = 7
Link.workingDir ectory = "C:\"
Link.Save
end sub

"Cor Ligthert [MVP]" <no************ @planet.nlschre ef in bericht
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
>>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.N avigate("about: <html><body
onload=javascr ipt:window.exte rnal.addFavorit e('" + textbox1.Text +
"')></body></html>")
///

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

Cor

"Cross" <cr*********@ga wab.comschreef in bericht
news:uU******* *******@TK2MSFT NGP04.phx.gbl.. .
>>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



Apr 23 '07 #6
"Cor Ligthert [MVP]" <no************ @planet.nlschri eb:
I think that you will be happy with this more by the time way. It covers
in my idea even more.

http://www.vb-tips.com/dbpages.aspx?...b-23cab5aa1049
Is there any reason why backslashes are escaped the C#-style way in the
string containing the path?

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Apr 23 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1242
by: TC | last post by:
I know .NET setup projects use "Windows Installer" shortcuts instead of ordinary shortcuts, but I'm having trouble with those, so I'd like to hard-code some ordinary shortcuts in the user's start menu. The problem is, the setup project will let me put every kind of file in the start menu except .lnk files. The one file type I need is the one file type which seems to be rejected. Perhaps there is some trick I don't know about. For the...
3
5635
by: Stanislaw Findeisen | last post by:
Does anyone know how to create file shortcuts in Windows? The only way I know is like: --------------------------------------------------------------- import win32com.client wScriptShellObject = win32com.client.Dispatch("WScript.Shell") shortcutName = unicode("shortcut.lnk", "utf8")
2
2293
by: David Krmpotic | last post by:
Hi All!! Could you please help me with three problems: 1. I would like to have a procedure that returned true if the file is writtable=deletable.. I tried everything but so far the only way I can really tell if the file can be delete is to actually try to delete it and catch an exception.. Trying to open a file with StreamReader in write mode
1
1997
by: noleander | last post by:
Hello. Ive got a VC++ program. Inside the program Ive got some code that has a full file path: C:\aa\bb\cc\dd\file.txt One of the folders in that path (cc) is a shortcut pointing to some other folder far away. The program doesnt seem to follow the shortcut. Im used to Unix, where shortcuts are indistinguishable from folders (or files) and you cannot have a
13
4244
by: DH | last post by:
Hi, I'm trying to strip the html and other useless junk from a html page.. Id like to create something like an automated text editor, where it takes the keywords from a txt file and removes them from the html page (replace the words in the html page with blank space) I'm new to python and could use a little push in the right direction, any ideas on how to implement this? Thanks!
4
12476
by: garyusenet | last post by:
I want to write a quick and simple programme to update a shortcut on about 20 peoples workstations. They will all have the same shortcut, so I thought the simplest way would be to create the shortcut on one computer and just copy it to their desktops. However I would like to add two extra features to this. 1. I would like to log when the users use the programme. I will just create a network text file and append a line each time the...
0
1529
by: Sin Jeong-hun | last post by:
I would like to display the shortcuts in a folder on my C# application. Of course I would like the linked application to be executed when the user double click on a icon. To do so, I need to be able to get the icon and the target path from .lnk files. I've searched Google and found that many pages lead to http://www.msjogren.net/dotnet/eng/samples/dotnet_shelllink.asp. The sample program looked fine and I thought it would give me all...
3
1930
by: deerhide | last post by:
Hi, I was updating my website, well trying to... and I somehow messed it up. I didnt build it, I bought it so I don't know alot about programming. I receive these errors when going to minbiketrader.com : Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home/content/m/i/n/minibiketrader/html/index.php on line 2 Parse error: parse error, unexpected T_REQUIRE_ONCE in /home/content/m/i/n/minibiketrader/html/index.php on line...
4
2497
by: David Jackson | last post by:
Hello, I've been asked to write a sort of "desktop clean-up" utility. Requirements are simple: iterate through the shortcuts (*.lnk files) on the currently logged-on user's desktop, and delete each link whose TargetPath property no longer exists. Iterating through the shortcuts on the desktop is easy enough using Directory.GetFiles(*.lnk)
0
9646
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9483
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10346
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10157
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10096
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
5386
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5514
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4055
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2887
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.