¿Hay una manera de resolver un objetivo .lnk que funciona para los enlaces que terminan en c: \ windows \ instalador?
-
12-09-2019 - |
Pregunta
La forma habitual de resolver LNK involucran el uso de WShell.WshShortcut o IShellLink de esa manera:
var WshShell = WScript.CreateObject("WScript.Shell");
var oShellLink = WshShell.CreateShortcut(strDesktop + "\\some-shortcut.lnk");
WScript.Echo(oShellLink.TargetPath)
Sin embargo, hay vínculos que no se pueden resolver de esa manera: poner fin a la resolución en C: \ Windows \ Installer \ {GUID} algunos-\ python_icon.exe , por ejemplo. La mayoría de los programas de Office tienen este problema también.
CodeProject tiene otra solución hecha por ingeniería inversa de la LNK formato http: // www. codeproject.com/KB/shell/ReadLnkFile.aspx pero no funciona de ver estos casos.
¿Hay alguna otra manera?
¿Qué es esta carpeta C: \ Windows \ Installer? Y ¿qué es esto something_icon.exe que se pone en ella?
Solución
Ok he encontrado la solución aquí: http://social.msdn.microsoft.com/Forums/en-US/winformssetup/thread/2df18f93-77d8-4217-94a1-6cbe5333a6c4
Debido a que estos son LNK LNK MSI tiene que usar funciones Msi resolver la ruta:
TCHAR pc [50] = {0};
TCHAR feat [100] = {0};
TCHAR comp [50] = {0};
int b=MsiGetShortcutTarget("Python (command line).lnk",pc,feat,comp);
TCHAR pth [500] = {0};
DWORD chs = 500;
int i = MsiGetComponentPath (pc, comp, pth, &chs);
PTH contiene la ruta.