您的位置:首页 > 博客中心 > 互联网 >

安装包创建桌面快捷方式

时间:2022-04-23 13:39


private void CreateDesktop() { string path = this.Context.Parameters["targetdir"]; path = path.Substring(0, path.LastIndexOf("/")); if (!System.IO.File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory) + "//" + "微信打印机.lnk")) { WshShell shell = new WshShell(); IWshShortcut shortcut = (IWshShortcut)shell.CreateShortcut( Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory) + "//" + "微信打印机.lnk" ); shortcut.TargetPath = System.Reflection.Assembly.GetExecutingAssembly().Location; shortcut.WorkingDirectory = System.Environment.CurrentDirectory; shortcut.WindowStyle = 1; //Normal window shortcut.Description = "微信打印机"; shortcut.IconLocation = path + "ico//desktop.ico"; shortcut.Save(); } }

 

本类排行

今日推荐

热门手游