lnk

Creating a lnk in VBS

◇◆丶佛笑我妖孽 提交于 2020-01-05 08:32:06
问题 I get an error that on line 6, the one with lnk.TargetPath, that the argument is invalid. I am hoping to make a link to this program under the start menu on the desktop. Anybody know why it is doing this? Set objShell = WScript.CreateObject("WScript.Shell") Set lnk = objShell.CreateShortcut("C:\Users\%USERDATA%\Desktop\Shutdown.LNK") Dim strUserProfile strUserProfile = objShell.ExpandEnvironmentStrings("%USERPROFILE%") lnk.TargetPath = "C:\Users\" & strUserProfile & "\AppData\Roaming

Creating a lnk in VBS

你。 提交于 2020-01-05 08:31:31
问题 I get an error that on line 6, the one with lnk.TargetPath, that the argument is invalid. I am hoping to make a link to this program under the start menu on the desktop. Anybody know why it is doing this? Set objShell = WScript.CreateObject("WScript.Shell") Set lnk = objShell.CreateShortcut("C:\Users\%USERDATA%\Desktop\Shutdown.LNK") Dim strUserProfile strUserProfile = objShell.ExpandEnvironmentStrings("%USERPROFILE%") lnk.TargetPath = "C:\Users\" & strUserProfile & "\AppData\Roaming

How I can use Shell32.dll in Silverlight OOB

 ̄綄美尐妖づ 提交于 2020-01-05 05:50:50
问题 I'd like to get the target information from a shortcut file using my silverlight OOB app, so I'm going to make the following code to work in my silverlight OOB. It seems I have to used P/Invoke to use Shell32.dll, but I'm not sure how I can use Folder, FolderItem, and ShellLinkObject? Most references explain how I can use the functions in the .dll using P/invoke:( Please give me any comments or sample code/links:) public string GetShortcutTargetFile(string shortcutFilename) { string pathOnly

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

孤人 提交于 2019-12-11 12:27:44
问题 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:\windows\installer\{some-guid}\python_icon.exe for example. Most Office programs have this issue too. CodeProject has another solution done by reverse

Spawning a .lnk windows shortcut with node.js gives “UNKNOWN” error

房东的猫 提交于 2019-12-11 08:18:02
问题 I'm having a game spawned as a child process. It all works nice and well with the game's original .exe file. However, I'd like it to execute minimized, and the only way to do it as far as I can tell is to create a windows shortcut (.lnk file, in the same directory) and set the launch options to minimized. Node.js doesn't like that: internal/child_process.js:313 throw errnoException(err, 'spawn'); ^ Error: spawn UNKNOWN at exports._errnoException (util.js:1026:11) at ChildProcess.spawn

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

此生再无相见时 提交于 2019-12-10 22:35:06
问题 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 = shl.[NameSpace](System.IO.Path.GetDirectoryName(lnkPath)) Dim itm = dir.Items().Item(System.IO.Path.GetFileName(lnkPath)) Dim lnk = DirectCast(itm.GetLink, Shell32.ShellLinkObject) Return lnk.Target.Path End Function It works for some .lnk files, but for example if I add my Skype.exe desktop

How to track .lnk files in git?

微笑、不失礼 提交于 2019-12-10 18:28:36
问题 I have .lnk files in my git repo. And other users are able to use them after cloning the repo successfully. However, once you have used it (clicked on it for example), it automatically becomes modified in git. Is there a way to avoid this? In general, what is your best practice for tracking .lnk files in git? Or is there a better alternative? 回答1: You can point git to assume that this lnk file is unchanged by: git update-index --assume-unchanged <lnk-file> You can undo that by: git update

change the icon of a windows shortcut .lnk file using python

ぃ、小莉子 提交于 2019-12-06 15:31:01
问题 I want to change the icon of a .lnk file after I have created it. This is my main code so far: import win32com.client shell = win32com.client.Dispatch("WScript.Shell") shortcut = shell.CreateShortCut("shortcut.lnk") shortcut.Targetpath = "C:\\Users\Benjie\AppData\Local\Programs\Python\Python36\python.exe" shortcut.save() This creates a shortcut with the python icon, but I want to change it to a different icon, if possible, to the icon of a different .exe file. How can I do this? I'd

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

房东的猫 提交于 2019-12-05 00:57:07
问题 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

Produce lnk file on GNU/Linux to transfer to windows

杀马特。学长 韩版系。学妹 提交于 2019-12-04 20:03:31
问题 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