This tutorial will show you how to create a shortcut for the executable application in C#.Net
To play the demo, you need to create a new windows forms application or console application project, then add a reference to the 'Windows Script Host Object' library from the 'COM' tab
using IWshRuntimeLibrary;
void CreateShortcut(string path, string targetpath, string shortcutname)
{
var wsh = new IWshShell_Class();
IWshRuntimeLibrary.IWshShortcut shortcut = wsh.CreateShortcut(
path + "\\" + shortcutname + ".lnk") as IWshRuntimeLibrary.IWshShortcut;
shortcut.TargetPath = targetpath;
shortcut.Save();
}
To create a shortcut to desktop you can write your code as shown below
string path = Environment.GetFolderPath(Environment.SpecialFolder.StartMenu);
CreateShortcut(path, Application.ExecutablePath, "c-sharpcode");