zoukankan
html css js c++ java
asp.net 桌面快捷方式
给asp.net项目安装程序添加快捷方式
//
添加以下引用:COM 下 Windows Script Host Object Model,然后
//
using System.Runtime.InteropServices;
//
using IWshRuntimeLibrary;
private
void
AddShortcut()
{
string
[] vPath
=
this
.targetdir.Split(
'
\\
'
);
string
url
=
"
http://
"
+
this
.iis
+
"
/
"
+
vPath[vPath.Length
-
2
];
try
{
string
mysite
=
url;
//
创建收藏夹快捷方式
string
fav
=
System.Environment.GetFolderPath(System.Environment.SpecialFolder.Favorites)
+
"
\\MX系统.url
"
;
IWshShell_Class wshShell
=
new
IWshShell_ClassClass();
//
创建 Windows Script Host Shell 类
IWshURLShortcut favShortcut
=
wshShell.CreateShortcut(fav)
as
IWshURLShortcut;
//
定义快捷方式文件
favShortcut.TargetPath
=
mysite;
favShortcut.Save();
//
保存快捷方式
//
创建桌面快捷方式
string
desktop
=
System.Environment.GetFolderPath(System.Environment.SpecialFolder.Desktop)
+
"
\\MX系统.url
"
;
IWshURLShortcut desktopShortcut
=
wshShell.CreateShortcut(desktop)
as
IWshURLShortcut;
desktopShortcut.TargetPath
=
mysite;
desktopShortcut.Save();
//
保存快捷方式
}
catch
(Exception exc)
{
throw
new
Exception(
"
创建快捷方式错误!
"
+
exc.Message);
}
}
查看全文
相关阅读:
算法基础<七> 加权有向图
union 分页/group/join 复杂查询(.net core/framework)
扩展Elasticsearch客户端简化ES查询(.net core/framework)
对EF Core进行扩展使支持批量操作/复杂查询
Grpc对象转proto代码工具
扩展ADO.net实现对象化CRUD(.net core/framework)
Sublime Text 4 破解笔记
python三元表达式(三目运算符)的坑
xaf-常见问题解答
xaf.blazor中如何开启诊断按钮
原文地址:https://www.cnblogs.com/wf225/p/1176274.html
最新文章
SpringCloud学习笔记
SpringBoot学习笔记(十一)
Shiro
SpringBoot学习笔记(十)
SpringBoot学习笔记(九)
SpringBoot学习笔记(八)
SpringBoot学习笔记(六)
SpringBoot学习笔记(五)
SpringBoot学习笔记(四)
SpringBoot学习笔记(三)
热门文章
SpringBoot学习笔记(二)
SpringBoot学习笔记(一)
mybatis报错java.lang.UnsupportedOperationException
MongoDB更新内嵌list中某个字段的值
使用Jackson来指定读/写序列化
window10解决端口占用
VM centos7配置静态IP
一款简单快速构建后台管理系统前后端的框架
算法基础<九> 字符串查找
算法基础<八> 字符串排序
Copyright © 2011-2022 走看看