我们有一个网络驱动器完全快捷方式(.LNK文件)指向的文件夹,我需要编程遍历他们在C#的WinForms应用程序。
We have a network drive full of shortcuts (.lnk files) that point to folders and I need to traverse them programmatically in a C# Winforms app.
什么的实际的选择我呢?
添加IWshRuntimeLibrary作为参考,您的项目。添加引用,COM选项卡,Windows脚本宿主对象模型。
Add IWshRuntimeLibrary as a reference to your project. Add Reference, COM tab, Windows Scripting Host Object Model.
下面是我如何得到一个快捷方式的属性:
Here is how I get the properties of a shortcut:
IWshRuntimeLibrary.IWshShell wsh = new IWshRuntimeLibrary.WshShellClass();
IWshRuntimeLibrary.IWshShortcut sc = (IWshRuntimeLibrary.IWshShortcut)wsh.CreateShortcut(filename);
快捷方式对象SC有TARGETPATH属性。
The shortcut object "sc" has a TargetPath property.
下一篇:半 - 围栏和全栅栏?围栏、栅栏