C# .NET Create Application Shortcut

By [)ia6l0 iii

To create an application shortcut, use the Windows Script Host library.

Add a reference to the Windows Script Host Library and add the following code.

using IWshRuntimeLibrary;

var theShell = new WshShell();
var shortcut = (IWshShortcut)theShell.CreateShortcut(string.format("{0}.lnk", pathoftheShortcut);
shortcut.TargetPath = Application.ExecutablePath;

Related FAQs

Use the Environment class to get important and user-specific properties like the User Profile folder.
Extension method to get the start of a day
You can truncate the file paths using the Shell LightWeight library.
Extension method to get the elasped time
Use the following code snippet to download an image from an URL.
You can create short url's using the Google URL Shortening API
C# .NET Create Application Shortcut  (1920 Views)