using ShellLinkPlus;
using System;
using System.IO;
using System.Linq;
namespace SetLnkApp
{
class Program
{
static void Main(string[] args)
{
bool existing = File.Exists(args[0]);
using (ShellLink shortcut = new ShellLink(existing ? args[0] : null))
{
if (existing)
{
if (args.Length > 2)
{
throw new Exception("For an existing shortcut, only pass AppUserModelId");
}
}
else
{
shortcut.TargetPath = args[2];
//shortcut.Arguments = args.Length > 3 ? string.Join(" ", args.Skip(3)) : "";
shortcut.Arguments = string.Join(" ", args.Skip(3));
}
shortcut.AppUserModelID = args[1];
shortcut.Save(args[0]);
}
}
}
}