WPF Create desktop shortcuts

Source: Internet
Author: User

#region Create a desktop shortcut, string desktop = System.Environment.GetFolderPath (System.Environment.SpecialFolder.Desktop); string            Dirpath = System.Environment.CurrentDirectory; String exepath = assembly.getexecutingassembly (). Location; System.Diagnostics.FileVersionInfo exeinfo = System.Diagnostics.FileVersionInfo.GetVersionInfo (ExePath); System.IO.File.Exists (String. Format (@ "{0}\ shortcut key name. lnk", DeskTop))) {//System.IO.File.Delete (string. Format (@ "{0}\ shortcut key name. lnk", desktop);//Delete the original desktop shortcut key way return;} WshShell shell = new WshShell (); Iwshshortcut shortcut = (iwshshortcut) shell. CreateShortcut (Environment.getfolderpath (Environment.SpecialFolder.DesktopDirectory) + "\ \" + "shortcut key name. lnk"); Shortcut.         TargetPath = @exePath; Target file shortcut.    WorkingDirectory = Dirpath; Destination Folder shortcut.               WindowStyle = 1; The window state of the target application is divided into normal, maximized, and Minimized "1,3,7" shortcut.   Description = "Automatic Update program"; Describes shortcut. IconLocation = string.  Format (@ "{0}\64.ico", dirpath); Shortcut icon shortcut. Arguments = ""; shortcut. Hotkey ="Shift+delete"; Shortcut key shortcut. Save (); #endregion

  

WPF Create desktop shortcuts

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.