我正在尝试检索 Windows .lnk 快捷方式的目标路径,但根据 .lnk 文件的属性,“目标”不是实际文件路径:
我正在使用 IWshRuntimeLibrary,并且我正在访问的快捷方式对象的类型为 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;
“链接”对象的 TargetPath 属性不是实际 .exe 的位置:“C:\Windows\Installer{F843C6A3-224D-4615-94F8-3C461BD9AEA0}\PaintShopProExeIcon.ico”
我可以从该对象获取WorkingDirectory 属性,该属性似乎与上图中快捷方式的“Start in”属性相同。我的问题是,如果 TargetPath 不是实际的 .exe 路径,如何获取快捷方式将打开的 .exe 文件的实际目标路径?这些信息在哪里?
本例中的实际目标路径是“C:\Program Files (x86)\Jasc Software Inc\Paint Shop Pro 9\Paint Shop Pro 9.exe”。系统怎么知道具体要打开“Paint Shop Pro.exe”呢?
None
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)