1、添加引用Windows Script Host Object Model,并引用命名空间using IWshRuntimeLibrary;
2、代码
using System;
using IWshRuntimeLibrary;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public void CreateShortCut()
{
string DesktopPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Desktop);//得到桌面文件夹
WshShell shell = new WshShell();
IWshShortcut shortcut = (IWshShortcut)shell.CreateShortcut(Desk