会员
周边
众包
新闻
博问
闪存
所有博客
当前博客
我的博客
我的园子
账号设置
简洁模式
...
退出登录
注册
登录
yongwnet
博客园
首页
新随笔
联系
订阅
管理
创建并运行快捷方式
using
System;
using
System.Collections.Generic;
using
System.ComponentModel;
using
System.Data;
using
System.Drawing;
using
System.Text;
using
System.Windows.Forms;
using
IWshRuntimeLibrary;
namespace
WindowsApplication2
{
public
partial
class
Form1 : Form
{
public
Form1()
{
InitializeComponent();
}
private
void
button1_Click(
object
sender, EventArgs e)
{
this
.CreateLink();
System.Diagnostics.Process.Start(
"
C:\\mysql\\dbChecked
"
);
}
void
CreateLink()
{
WshShell shell
=
new
WshShell();
IWshShortcut shortcut
=
(IWshShortcut)shell.CreateShortcut(
"
c:\\mysql
"
+
"
\\
"
+
"
dbChecked.lnk
"
);
shortcut.TargetPath
=
"
C:\\mysql\\pack516.BAT
"
;
shortcut.WorkingDirectory
=
"
C:\\mysql
"
;
shortcut.WindowStyle
=
7
;
shortcut.Description
=
"
dbChecked
"
;
shortcut.IconLocation
=
System.Environment.SystemDirectory
+
"
\\
"
+
"
shell32.dll, 165
"
;
shortcut.Save();
}
}
}
注:需引用COM组件"Windows Script Host Object Model"
posted @
2007-05-26 22:36
yongwnet
阅读(
369
) 评论(
0
)
编辑
收藏
举报
会员力量,点亮园子希望
刷新页面
返回顶部
公告