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(); } }
时间: 2024-10-31 18:03:29