C# 创建一个application的桌面快捷方式
2016-12-06 10:48
309 查看
1, 项目中添加一个引用。Project > Add
Reference > COM > Windows
Script Host Object Model.
示例代码:
WshShell shell = new WshShell();
string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
string shotcutName = "alex.lnk";
string shortcutAddress = Path.Combine(desktopPath, shotcutName);
IWshShortcut shortcut = (IWshShortcut)shell.CreateShortcut(shortcutAddress);
shortcut.Description = "New shortcut for a Notepad";
//shortcut.Hotkey = "Ctrl+Shift+N";
shortcut.TargetPath = Environment.GetFolderPath(Environment.SpecialFolder.System) + @"\notepad.exe";
shortcut.Save();
Reference > COM > Windows
Script Host Object Model.
示例代码:
WshShell shell = new WshShell();
string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
string shotcutName = "alex.lnk";
string shortcutAddress = Path.Combine(desktopPath, shotcutName);
IWshShortcut shortcut = (IWshShortcut)shell.CreateShortcut(shortcutAddress);
shortcut.Description = "New shortcut for a Notepad";
//shortcut.Hotkey = "Ctrl+Shift+N";
shortcut.TargetPath = Environment.GetFolderPath(Environment.SpecialFolder.System) + @"\notepad.exe";
shortcut.Save();
相关文章推荐
- 开机默认设置一个widge在指定的屏幕上和自动在桌面上创建一个应用的快捷方式的方法
- C#如何编程在桌面创建快捷方式
- Windows服务System权限下在当前用户桌面创建快捷方式C#实例程序
- Ubuntu下如何在桌面创建一个桌面快捷方式
- C#创建一个文件的快捷方式
- 用C#创建应用程序桌面快捷方式
- 创建一个远程桌面连接的快捷方式
- C#创建一个文件的快捷方式
- C# 创建快捷方式,如建立桌面和程序夹的快捷方式链接,并且上ALL USERS级别
- C#创建桌面快捷方式
- C# 创建桌面快捷方式【转】
- Android_如何为一个app创建桌面快捷方式
- wince c# 创建桌面快捷方式 自动启动 只运行一次 全屏显示
- C# 创建一个文件夹快捷方式
- Linux系统:Ubuntu下如何在桌面创建一个应用程序的“快捷方式”?
- C#实现创建桌面快捷方式与添加网页到收藏夹的示例
- Ubuntu下如何在桌面创建一个应用程序的“快捷方式”?
- [No000074]C#创建桌面快捷方式
- c#通过纯代码创建桌面快捷方式、创建程序菜单项、将网页添加到收藏夹
- 创建桌面快捷方式+设置开机启动代码[C#、WinForm]