I am trying to make an app that creates a shortcut for selected program. When the program starts, it shows all programs in listbox
and you can search for the program. How to create a shortcut from selected program inside listbox
and name it like selected program. I used this code but I only created a shortcut for notepad.
Create shortcut on desktop C#
private void CreateShortcut()
{
object shDesktop = (object)"Desktop";
WshShell shell = new WshShell();
//string shortcutAddress = (string)shell.SpecialFolders.Item(ref shDesktop) + @"\Notepad.lnk";
string shortcutAddress = (string)shell.SpecialFolders.Item(ref shDesktop) + @"\Notepad.lnk";
IWshShortcut shortcut = (IWshShortcut)shell.CreateShortcut(shortcutAddress );
shortcut.Description = "New shortcut for a Notepad";
shortcut.Hotkey = "Ctrl+Shift+N";
shortcut.TargetPath = Environment.GetFolderPath(Environment.SpecialFolde r.System) + @"\notepad.exe";
shortcut.Save();
}