C#两种创建快捷方式的方法
用WSH直接创建快捷方式: 1.首先要添加引用. 添加引用的方法非常简单,右击你的项目并选择添加引用, 选择 COM 选项卡并选择 Windows Script Host Object Model 2.引用命名空间 using System.Runtime.InteropServices;//互动服务 using IWshRuntimeLibrary; 3.创建快捷方式(注释中有详细说明) //实例化WshShell对象 WshShell shell = new WshShell(); //通过该对象的 CreateShortcut 方法来创建 IWshShortcut 接口的实例对象 IWshShortcut shortcut = (IWshShortcut)shell.CreateShortcut( Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "//ShortCut.lnk"); //设置快捷方式的目标所在的位置(源程序完整路径) shortcut.TargetPath = System.Reflection.Assembly.GetExecutingAssembly().Location; //应用程序的工作目录 //当用户没有指定一个具体的目录时