zl程序教程

您现在的位置是:首页 >  后端

当前栏目

2019-8-31-C#-如何引用-WshShell-类

c# 如何 引用 2019 31
2023-09-27 14:28:53 时间
title author date CreateTime categories
C# 如何引用 WshShell 类
lindexi
2019-08-31 16:55:58 +0800
2019-3-19 9:6:10 +0800
C#

如果想要创建快捷方式等,很多使用都需要引用 WshShell 类,这个类需要通过 COM 的方法引用

引用 WshShell 不是在一个程序集,而是 Windows Script Host Object Model 一个 COM 组件,通过下面步骤可以引用

创建一个控制台项目,右击引用,添加 COM 请看下图

添加命名空间 using IWshRuntimeLibrary; 就可以使用了

参见 使用 C# 代码创建快捷方式文件 - walterlv

Windows Script Host: Scripting; Management Services