Questions tagged [lnk]

Use this tag for questions about Windows .lnk files representing Shortcuts (or Shell Links). For questions about link errors after compilation (of for example C/C++ code) use the tag [linker-error]

Use this tag if your question is about working with the .lnk (Shell Links) files from a programming perspective.

This can include:

  • the creation of such .lnk files,
  • the required registry keys,
  • its installation by means of a setupprogram,
  • its binary format
  • the relation with IShellLink

Notice that in Unix variants those files are sometimes called .Desktop files.

Wikipedia reference

128 questions
3
votes
0 answers

Python change the icon of an existing windows shortcut

I wanted to modify the icon of an already existing Windows shortcut (aka a .lnk file) using an externally created .ico file, and not one provided by Windows itself (by this I mean using an icon preferably located in the same folder as the .py…
SaltyHelpVampire
  • 305
  • 2
  • 4
  • 15
3
votes
4 answers

Launching Shell Links (LNKs) from WOW64

Our 32-Bit application launches Windows LNK files (Shell Links) via ShellExecute. When it tries to "launch" a link to a 64-Bit binary (such as the "Internet Explorer (64-Bit)" shortcut in Start Menu) it always ends up launching the 32-Bit binary.…
ilm
3
votes
2 answers

Copy files from folder of lnk files back into folder

I have a bunch of folders, each containing a number of shortcut link files to mp3 files existing in completely separate folders. eg: /rock-mp3-shortcuts /jazz-mp3-shortcuts /funk-mp3-shortcuts what command would I run (or program to use) to copy…
Adrian33
  • 281
  • 5
  • 16
3
votes
4 answers

General approach to reading lnk files

Several frameworks and languages seem to have lnk file parsers (C#, Java, Python, certainly countless others), to get to their targets, properties, etc. I'd like to know what is the general approach to reading lnk files, if I want to parse the lnk…
MPelletier
  • 16,256
  • 15
  • 86
  • 137
3
votes
3 answers

Reformatting Windows lnk file via an automated script

Problem: There are a bunch of .lnk files on the C drive that point to the J: drive, but the J: drive is gone, and the P: drive has replaced it. Various tricks have been done to get the .lnk files to still work anyway, but it's getting annoying, and…
dreftymac
  • 31,404
  • 26
  • 119
  • 182
3
votes
1 answer

Java parser for Windows shortcut (.lnk) created by cygwin

Following a previous discussion on lnk files parsing in java ( Windows shortcut (.lnk) parser in Java? ). I've tested all solutions proposed. But no one works with my lnk files created by cygwin, when I untar an archive containing sym links…
Eddy
  • 31
  • 2
2
votes
2 answers

VB.NET / C# code to access target path of link (lnk) files produces some wrong paths

I found this code: Public Shared Function GetLnkTarget(ByVal lnkPath As String) As String Dim shl = New Shell32.Shell() ' Move this to class scope lnkPath = System.IO.Path.GetFullPath(lnkPath) Dim dir =…
user670186
  • 2,588
  • 6
  • 37
  • 55
2
votes
1 answer

Open a Windows shortcut file `.lnk` with subprocess

I am fairly new to Python and have been trying to make a program that will open the "Minecraft launcher" for me. Context However, the new launcher .exe file is blocked as it is located in the windowsapp file which requires a lot of faffing about…
Calax
  • 37
  • 4
2
votes
1 answer

IShellLinkW::GetPath( SLGP_RAWPATH ) does not return the 'raw' target of a lnk file

I noticed that the method IShellLinkW::GetPath returns an empty string if the target of a shortcut points to a special folder, like 'My PC', or a Control Panel applet. Sample code ' CLSID_ShellLink from ShlGuid.h Dim cShellLink As New CShellLink()…
ElektroStudios
  • 19,105
  • 33
  • 200
  • 417
2
votes
0 answers

Windows shortcut (.lnk) filesize

The size of shortcut (.lnk) files on my computer (Windows 7) ranges from 235 to 15,881 bytes, with an average of 2,395 bytes. In Microsoft's documentation of the shortcut file format, it contains an extraordinary amount of information, including…
NewSites
  • 1,402
  • 2
  • 11
  • 26
2
votes
0 answers

Issue mapping a network location with vb script

We have a strange issue when mapping a SharePoint 2013 WebDAV location to Windows 10 Network Locations. We map these locations with a VB script: dim SecurityGroup(1) dim OneDriveName,…
OutOfThisPlanet
  • 336
  • 3
  • 17
2
votes
0 answers

How to set shortcut file target path with windows variables

I am trying to create a shortcut link to pointing some target file. I am able to put static target path but the problem is when I move the target file to some other place it's unable to open the target file cause target path don't have this…
Siva kumar
  • 215
  • 4
  • 13
2
votes
1 answer

SHGetFileInfo for lnk file without lnk overlay arrow

I'm trying to get the icon out of a .lnk file without the .lnk overlay appearing. The documentation has information about a flag SHGFI_ADDOVERLAYS which can be set to add an overlay, but I am looking to remove the overlay. I have read this question,…
xandermonkey
  • 4,054
  • 2
  • 31
  • 53
2
votes
2 answers

Create lnk shortcut from lua (without lfs)

I would like to write a function to create a windows .lnk file from my lua script. I found a function in the LuaFileSystem library . Is there a way to do this without the library? (The reason: I am writing the script for multiple users, would be…
Tamaska Janos
  • 61
  • 1
  • 6
2
votes
1 answer

How to add command parameter to windows shortcut

When I typed this command in cmd.exe: E:\mywamp\redis-2.8.19\redis-server.exe --maxheap 512mb it ran successfully. I want to create a windows shortcut to start redis quickly. So I created a shortcut in windows and filled the target input with the…
yunnysunny
  • 183
  • 1
  • 15
1
2
3
8 9