private void CreateShortcut(string shortcut) { if (File.Exists(shortcut)) { return; } using (var link = new ShellLink()) { link.Target = _mainExecutable; link.Description = _application; link.WorkingDirectory = Path.GetDirectoryName(Path.GetDirectoryName(_mainExecutable)); link.Save(shortcut); } }
private void CreateStartMenuIcon(string path) { var startPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.StartMenu), "Programs"); using (ShellLink shortcut = new ShellLink()) { shortcut.Target = Path.Combine(path, "MediaCrush.exe"); shortcut.Description = "MediaCrush"; shortcut.WorkingDirectory = path; shortcut.DisplayMode = ShellLink.LinkDisplayMode.edmNormal; shortcut.Save(Path.Combine(startPath, "MediaCrush.lnk")); } }