欢迎访问 生活随笔!

生活随笔

当前位置: 首页 > 编程语言 > C# >内容正文

C#

C#创建桌面快捷方式

发布时间:2023/12/4 C# 51 豆豆
生活随笔 收集整理的这篇文章主要介绍了 C#创建桌面快捷方式 小编觉得挺不错的,现在分享给大家,帮大家做个参考.

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

总结

以上是生活随笔为你收集整理的C#创建桌面快捷方式的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。