Windows 是一种脚本宿主 ,WshShell 对象,提供对本地 Windows 外壳程式的访问。
基本介绍
- 中文名:wshshell
- 属性:脚本宿主
- 提供:对本地 Windows 外壳程式的访问
- AppActivate:激活一个应用程式视窗
WshShell百科名片
Windows 是一种脚本宿主 ,WshShell 对象,提供对本地 Windows 外壳程式的访问。

WshShell基础介绍
属性 说明
CurrentDirectory 返回或改变当前目录。

Environment 返回 WshEnvironment 集合对象。
SpecialFolders 使用 WshSpecialFolders 对象提供对 Windows shell 资料夹的访问,如桌面资料夹,开始选单资料夹和个人文档资料夹。
方法 说明
AppActivate 激活一个应用程式视窗。
CreateShortcut 创建并返回 WshShortcut 对象。
Exec 在子命令视窗中运行一个应用程式,提供访问StdIn/StdOut/StdErr流。
ExpandEnvironmentStrings 扩展 PROCESS 环境变数并返回结果字元串。
LogEvent 添加一个事件到日誌档案。
Popup 显示包含指定讯息的讯息视窗。
RegDelete 从注册表中删除指定的键或值。
RegRead 从注册表中返回指定的键或值。
RegWrite 在注册表中设定指定的键或值。
Run 创建新的进程,该进程用指定的视窗样式执行指定的命令。
SendKeys 传送一个或多个按键到活动视窗。
函式原型(VB写法)
Function AppActivate(App, [Wait]) As Boolean
Function CreateShortcut(PathLink As String) As Object
Property CurrentDirectory As String
Property Environment([Type]) As WshEnvironment '唯读
Function Exec(Command As String) As WshExec
Function ExpandEnvironmentStrings(Src As String) As String
Function LogEvent(Type, Message As String, [Target As String]) As Boolean
Function Popup(Text As String, [SecondsToWait], [Title], [Type]) As Long
Sub RegDelete(Name As String)
Function RegRead(Name As String)
Sub RegWrite(Name As String, Value, [Type])
Function Run(Command As String, [WindowStyle], [WaitOnReturn]) As Long
Sub SendKeys(Keys As String, [Wait])
Property SpecialFolders As WshCollection '唯读
相关对象
WshCollection 对象

Function Count() As Long
Function Item(Index) '预设
Property length As Long '唯读
WshEnvironment 对象
Function Count() As Long
Property Item(Name As String) As String '预设
Property length As Long '唯读
Sub Remove(Name As String)
WshExec 对象
Property ExitCode As Long '唯读
Property ProcessID As Long '唯读
Property Status As WshExecStatus '唯读
Property StdErr As TextStream '唯读
Property StdIn As TextStream '唯读
Property StdOut As TextStream '唯读
Sub Terminate()
WshExecStatus 常数
Const WshFailed = 2
Const WshFinished = 1
Const WshRunning = 0
WshShortcut 对象
Property Arguments As String
Property Description As String
Property FullName As String '唯读 预设
Property Hotkey As String
Property IconLocation As String
Property RelativePath As String
Sub Save()
Property TargetPath As String
Property WindowStyle As Long
Property WorkingDirectory As String
WshURLShortcut 对象
Property FullName As String '唯读 预设
Sub Save()
Property TargetPath As String
WshWindowStyle 常数
Const WshHide = 0
Const WshMaximizedFocus = 3
Const WshMinimizedFocus = 2
Const WshMinimizedNoFocus = 6
Const WshNormalFocus = 1
Const WshNormalNoFocus = 4