/// <summary> /// Creates a new Windows shortcut in the "Startup" menu. /// </summary> /// <param name="autoStart">Information about the shortcut to be created.</param> /// <param name="target">The target the shortcut shall point to.</param> /// <param name="iconStore">Stores icon files downloaded from the web as local files.</param> /// <param name="machineWide">Create the shortcut machine-wide instead of just for the current user.</param> public static void Create(AutoStart autoStart, FeedTarget target, IIconStore iconStore, bool machineWide) { #region Sanity checks if (autoStart == null) { throw new ArgumentNullException(nameof(autoStart)); } if (iconStore == null) { throw new ArgumentNullException(nameof(iconStore)); } #endregion string filePath = GetStartupPath(autoStart.Name, machineWide); if (WindowsUtils.IsWindows) { var commandLine = new StubBuilder(iconStore).GetRunCommandLine(target, autoStart.Command, machineWide); Create(filePath, commandLine.First(), commandLine.Skip(1).JoinEscapeArguments()); } else { Create(filePath, target, autoStart.Command, iconStore); } }