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