给windows应用程序创建快捷方式

来源:互联网 发布:java第三方支付接口 编辑:程序博客网 时间:2024/06/11 10:11

 static void Main()
       {
           WshShell shell = new WshShell();
           IWshShortcut shortcut = (IWshShortcut)shell.CreateShortcut(
           Environment.GetFolderPath(Environment.SpecialFolder.StartMenu) +"\" + "Allen’s Application.lnk");
           shortcut.TargetPath =System.Reflection.Assembly.GetExecutingAssembly().Location;
           shortcut.WorkingDirectory =System.Environment.CurrentDirectory;
           shortcut.WindowStyle = 1;
           shortcut.Description = "Launch Allen’s Application";
           shortcut.IconLocation = System.Environment.SystemDirectory + "\" +"shell32.dll, 165";
           shortcut.Save();

           Application.EnableVisualStyles();
           Application.SetCompatibleTextRenderingDefault(false);
           Application.Run(new Form1());
       }

原创粉丝点击