如何编程创建快捷方式?

如果希望在C#里面创建快捷方式,大致可以参考下面的步骤

1. 添加对Windows Script Host Object Model的引用

image

2. 编写如下代码即可

using IWshRuntimeLibrary;
namespace CreateShortCutdemo
{
    class Program
    {
        static void Main(string[] args)
        {
            WshShell shell = new WshShell();
            WshShortcut shortcut = (WshShortcut)shell.CreateShortcut(@"E:\Temp\Test.lnk");
            shortcut.TargetPath = @"E:\Temp\Play.htm";
            shortcut.Save();
        }
    }
}

原文地址:https://www.cnblogs.com/chenxizhang/p/1257835.html