lnk

Get target of Windows .lnk shortcut using “Start in” directory

廉价感情. 提交于 2019-12-03 16:17:31
I am trying to retrieve the target path of a Windows .lnk shortcut, but the "Target" is not an actual file path according to the .lnk file's properties: I am using the IWshRuntimeLibrary and the shortcut object I am accessing is of type IWshShortcut: WshShell shell = new WshShell(); IWshShortcut link = (IWshShortcut)shell.CreateShortcut(lnkFileName); // This returns "C:\Windows\Installer\{F843C6A3-224D-4615-94F8-3C461BD9AEA0}\PaintShopProExeIcon.ico" var targetPath = link.TargetPath; // This is the same as the "Start in" value in the image above var workingDir = link.WorkingDirectory; The

Produce lnk file on GNU/Linux to transfer to windows

大憨熊 提交于 2019-12-03 12:46:57
I'll explain my goal first to avoid "XY Problem" misunderstandings. I want to be able to produce a file (on Linux) that, when downloaded to a Windows machine and double clicked, will open a (ms office, but it shouldn't matter IIUC) file with a known path (on the local windows machine) preset by the server. It seems what I'm trying to do is possible if I include the path of the file I want to open (and neither of the other details regarding the volume it's stored in etc) in the lnk file. I first checked the lnk file format specs trying to generate the file in a python script but that's not my

Creating Shortcut where folder name is having unicode characters

我与影子孤独终老i 提交于 2019-12-02 20:09:26
问题 I have been using the below code to create shortcuts dynamically. But the targetPath throws Argument exception when the folder name has unicode characters like Thai,greek language. IWshRuntimeLibrary.WshShell shell = new WshShell(); IWshShortcut shortcut = (IWshShortcut)shell.CreateShortcut(shortcutLocation); shortcut.Description = "My shortcut description"; // The description of the shortcut shortcut.WorkingDirectory = currentPath; shortcut.TargetPath = targetFileLocation; // The path of the

Creating Shortcut where folder name is having unicode characters

大憨熊 提交于 2019-12-02 07:36:49
I have been using the below code to create shortcuts dynamically. But the targetPath throws Argument exception when the folder name has unicode characters like Thai,greek language. IWshRuntimeLibrary.WshShell shell = new WshShell(); IWshShortcut shortcut = (IWshShortcut)shell.CreateShortcut(shortcutLocation); shortcut.Description = "My shortcut description"; // The description of the shortcut shortcut.WorkingDirectory = currentPath; shortcut.TargetPath = targetFileLocation; // The path of the file that will launch when the shortcut is run shortcut.Save(); Reference Shell32.dll from file system

Launching Shell Links (LNKs) from WOW64

耗尽温柔 提交于 2019-12-01 09:14:04
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 the LNK which holds FOLDERID_ProgramFiles. A 64-Bit app resolves this to the 64-Bit Program Files directory, but a 32-Bit app won't. Wow64DisableWow64FsRedirection does not change this behavior of ShellExecute. Besides going through a 64-Bit "trampoline"

Launching Shell Links (LNKs) from WOW64

早过忘川 提交于 2019-12-01 05:36:10
问题 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 the LNK which holds FOLDERID_ProgramFiles. A 64-Bit app resolves this to the 64-Bit Program Files directory, but a 32-Bit app won't.

Creating a file shortcut (.lnk)

喜你入骨 提交于 2019-11-28 23:14:41
I have been looking for a simple way to create a shortcut to a file in C#, but I've only found external dlls that do that. It's actually quite surprising, there's no built in way to do that.. Anyway, I know that lnk files are just text files with a certain command and a given path. I thought that maybe I could create a text file (in the code) set it's text to the right command and change it's extension to .lnk I've tried to do that manually first, but failed to do so. Is there a way to do something like that (or maybe another simple way) to create a shortcut to a certain path in c#? Just to be

C++, good old LNK1169 (and LNK2005) errors

孤人 提交于 2019-11-28 11:20:58
问题 I have 4 files, 2 headers and 2 cpp files. Header file one: #ifndef complex_2 #define complex_2 #include<iostream> #include<cmath> using namespace std; namespace comp { class complex{ protected: double re, im; public: complex(){re = im = 0;} complex(double re_in, double im_in){ re = re_in; im = im_in; } ~complex(){} void set_re(double re_in){ re = re_in; } void set_im(double im_in){ im = im_in; } double get_re() const{ return re; } double get_im() const{ return im; } complex comp_conj() const

General approach to reading lnk files

孤街醉人 提交于 2019-11-28 10:32:21
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? There is not an official document from Microsoft describing lnk file format but there are some documents which have description of the format. Here is one of them: Shortcut File Format (.lnk) As for the API you can use IShellLink Interface This is an old post, but

Creating a file shortcut (.lnk)

做~自己de王妃 提交于 2019-11-27 14:37:08
问题 I have been looking for a simple way to create a shortcut to a file in C#, but I've only found external dlls that do that. It's actually quite surprising, there's no built in way to do that.. Anyway, I know that lnk files are just text files with a certain command and a given path. I thought that maybe I could create a text file (in the code) set it's text to the right command and change it's extension to .lnk I've tried to do that manually first, but failed to do so. Is there a way to do