Click here to Skip to main content
Click here to Skip to main content

Tagged as

Edit shortcuts .lnk properties with C#

, 23 Nov 2009 CPOL
Rate this:
Please Sign up or sign in to vote.
This trick will allow you to edit shortcut properties in Windows.Add Windows Script Host Object Model reference under the COM tab. To do that, right click on References in Solution Explorer and then Add Reference. Insert the using statement: using IWshRuntimeLibrary; Here is the sample

This trick will allow you to edit shortcut properties in Windows.

  1. Add Windows Script Host Object Model reference under the COM tab. To do that, right click on References in Solution Explorer and then Add Reference.
  2. Insert the using statement: using IWshRuntimeLibrary;
  3. Here is the sample code
WshShell shell = new WshShell();

IWshShortcut link = (IWshShortcut)shell.CreateShortcut(filename);

Now you can set and get various shortcut properties via methods in the link object.  Be sure to call the Save() to save changes you made.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

samguan87
Software Developer (Junior)
United States United States
No Biography provided

Comments and Discussions

 
GeneralReason for my vote of 5 Spent some time PinmemberFastfootskater17-Jan-12 4:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.150123.1 | Last Updated 23 Nov 2009
Article Copyright 2009 by samguan87
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid