lnk

Windows shortcut (.lnk) parser in Java?

I'm currently using Win32ShellFolderManager2 and ShellFolder.getLinkLocation to resolve windows shortcuts in Java. Unfortunately, if the Java program is running as a service under Vista, getLinkLocation, this does not work. Specifically, I get an exception stating "Could not get shell folder ID list". Searching the web does turn up ment...

reformatting windows lnk file via automated script

Problem: There are a bunch of .lnk files on C drive that point to the J: drive, but the J: drive is gone 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 it's time to just fix the things. Question: Using Ruby, Python, WSH.JScript or Perl, can you iterat...

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. Internally, ShellExecute incorrectly resolves the link target: There's a hidden field inside...

Reading the target of a .lnk file in Python?

Hi, I'm trying to read the target file/directory of a shortcut (.lnk) file from Python. Is there a headache-free way to do it? The .lnk spec [PDF] is way over my head. I don't mind using Windows-only APIs.My ultimate goal is to find the "(My) Videos" folder on Windows XP and Vista. On XP, by default, it's at %HOMEPATH%\My Documents\My Vi...

Expression Web: Shortcut doesn't point to an exe file, but I want to use it to edit

Problem: I have to support users who need to edit web pages. Some of these web pages exist only as textarea controls. Fortunately, there is a firefox plugin that allows the user to open the textarea in a default text editor. Unfortunately, this plugin requires you to point to the EXE file of the text editor you want to invoke. This is a...

Wine linker error: trying to create .lnk

I'm trying to create an .lnk file programatically. I would prefer to use C, but C++ is fine (and is what all the MSDN stuff is in). The relevant code sample is: #include <windows.h> #include <shobjidl.h> #include <shlguid.h> HRESULT CreateLink(LPCSTR lpszPathObj, LPCSTR lpszPathLink, LPCSTR lpszDesc) { HRESULT hres; IShellLink* p...

Is there a way to resolve a .lnk target that works for links that end up in c:\windows\installer ?

The usual way to resolve lnk involve using WShell.WshShortcut or IShellLink that way : var WshShell = WScript.CreateObject("WScript.Shell"); var oShellLink = WshShell.CreateShortcut(strDesktop + "\\some-shortcut.lnk"); WScript.Echo(oShellLink.TargetPath) But there are links that can't be resolved that way : the resolution end up in c:...

Passing a shortcut to a batch script

My bat script accepts a filepath as a parameter, which allows me to drag-and-drop a file onto it from Explorer. Unfortunately when I drop a shortcut onto it, I simply get the filepath of the .lnk file itself, rather than the file that it refers to. Is there any way to derive the underlying filepath? I am looking for a native capability ...

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

Hi all, Following a previous discussion on lnk files parsing in java (http://stackoverflow.com/questions/309495/windows-shortcut-lnk-parser-in-java/1700377), I've tested all solutions proposed and no one works with my lnk files, created by cygwin when I untar an archive containing sym links created on a linux box. I got a java.lang.Arr...

.LNK File Shortcut Key no longer works if I press it while my C#, maximized, no border program is running

For a more general behavior probably caused by this problem please also read: http://stackoverflow.com/questions/2042925/shortcut-keys-defined-in-lnk-files-do-not-work-if-im-running-a-c-winforms-prog I'm writing a C# program, using .NET 2.0 and WinForms and Visual C# 2008 Express. I'm using Windows 7 but the problem is also under Windo...

Shortcut keys defined in .LNK files do not work if I'm running a C# WinForms program that has no border and it it maximized

To test this problem I wrote a simple C# program, using .NET 2.0 and WinForms and Visual C# 2008 Express. I'm using Windows 7 but the problem is also under Windows XP. Important: the FormBorderStyle property of the main form is set to None, and the WindowState to Maximized. The program does nothing special. When this program is running...

MSVCRTD.lib(cpu_disp.obj) : warning LNK4210: .CRT section exists; there may be unhandled static initializers or terminators

Hi I know this question has popped up before but I could not find a good answer so I try here. I have a pure C dll (Win32) and I get this warning when compiling: MSVCRTD.lib(cpu_disp.obj) : warning LNK4210: .CRT section exists; there may be unhandled static initializers or terminators Everything seems to work just fine but I am conce...

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 in another language that does not have said feature. Is there a Windows API for this? ...