该篇文章是我于2009年6月10日通过自己编写的工具,批量从位于在博客园的博客站点(http://chenxizhang.cnblogs.com)同步而来。文章中的图片地址仍然是链接到博客园的。特此说明! 陈希章原文地址:http://www.cnblogs.com/chenxizhang/archive/2008/08/01/1257835.html原文标题:如何编程创建快捷方式? 原文发表:2008/8/1 0:56:00 |
如果希望在C#里面创建快捷方式,大致可以参考下面的步骤
1. 添加对Windows Script Host Object Model的引用
2. 编写如下代码即可
using IWshRuntimeLibrary;
namespace CreateShortCutdemo
{
class Program
{
static void Main(string[] args)
{
WshShell shell = new WshShell();
WshShortcut shortcut = (WshShortcut)shell.CreateShortcut(@"E:/Temp/Test.lnk");
shortcut.TargetPath = @"E:/Temp/Play.htm";
shortcut.Save();
}
}
}
作者:陈希章 出处:http://blog.youkuaiyun.com/chen_xizhang 本文版权归作者所有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。 |