有没有办法解析适用于最终位于 c:\windows\installer 中的链接的 .lnk 目标?
解析 lnk 的常用方法涉及使用 WShell.WshShortcut 或 IShellLink :
var WshShell = WScript.CreateObject("WScript.Shell");
var oShellLink = WshShell.CreateShortcut(strDesktop + "\\some-shortcut.lnk");
WScript.Echo(oShellLink.TargetPath)
但是有些链接无法通过这种方式解析:解析最终位于 c:\windows\installer\{some-guid}\例如 python_icon.exe。 大多数 Office 程序也存在此问题。
CodeProject 有另一种解决方案,通过对 lnk 格式进行逆向工程 http://www.codeproject.com /KB/shell/ReadLnkFile.aspx 但在这些情况下它不起作用。
还有其他办法吗?
c:\Windows\Installer 文件夹是什么? 里面放的something_icon.exe 是什么?
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 engineering the lnk format http://www.codeproject.com/KB/shell/ReadLnkFile.aspx but it does not works in thoses cases.
Is there any other way ?
What is this c:\Windows\Installer folder ? And what is this something_icon.exe that is put in it ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好的,我在这里找到了解决方案: http://social.msdn.microsoft.com/Forums/en-US/winformssetup/thread/2df18f93-77d8-4217-94a1-6cbe5333a6c4
由于这些lnk是MSI lnk,你必须使用Msi函数解析路径:
pth 包含路径。
Ok I've found the solution here : http://social.msdn.microsoft.com/Forums/en-US/winformssetup/thread/2df18f93-77d8-4217-94a1-6cbe5333a6c4
Since these lnk are MSI lnk you have to use Msi functions to resolve the path :
pth contains the path.