您的位置:首页 > 编程语言 > C#

在 .NET 中创建快捷方式 [C#]

2005-09-01 22:08 323 查看
在 .NET 中创建快捷方式 [C#]

Creating Shortcuts in .NET [C#]

Written by Allen Lee

// Code #01

using System;
using IWshRuntimeLibrary;

class Program
// Code #02

shortcut.Arguments = "/out:output.txt /sortby:date /desc";
shortcut.Hotkey = "CTRL+ALT+F11";

注意:Hotkey 属性的值里面不能包含空格。

你可以在应用程序里面像平常那样处理命令行参数:

// Code #03

class Program

// Output:
//
// /out:output.txt
// /sortby:date
// /desc
现在,你把这个快捷方式放到桌面,每当你需要运行的时候,轻轻的按下 CTRL+ALT+F11 就行了,Cool ~ ~ ~

Appendix A

Mattias Sjogren 创建了一个名叫 ShellShortcut 的包装类(wrapper class),你可以在你的项目中直接使用它。有兴趣的话,你也可以对其进行一番研究。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: