WSHSHELL的用法

来源:互联网 发布:coc七本兵种升级数据 编辑:程序博客网 时间:2024/05/08 19:56

wshshell

 

  

 

  Windows 脚本宿主
 
  WshShell 对象,提供对本地 Windows 外壳程序的访问。
 
  属性 说明
 
  Environment 返回 WshEnvironment 集合对象。
 
  SpecialFolders 使用 WshSpecialFolders 对象提供对 Windows shell 文件夹的访问,如桌面文件夹,开始菜单文件夹和个人文档文件夹。
 
  方法 说明
 
  CreateShortcut 创建并返回 WshShortcut 对象。
 
  ExpandEnvironmentStrings 扩展 PROCESS 环境变量并返回结果字符串。
 
  Popup 显示包含指定消息的消息窗口。
 
  RegDelete 从注册表中删除指定的键或值。
 
  RegRead 从注册表中返回指定的键或值。
 
  RegWrite 在注册表中设置指定的键或值。
 
  Run 创建新的进程,该进程用指定的窗口样式执行指定的命令。
 
  WshShell 对象的属性和方法的函数原型(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