使用vbscript访问窗口的标题

我试图用VbScript来获得一个窗口的标题。 有什么办法可以实现吗? 就像我们在C#中做的那样

using System.Diagnostics; Process[] processlist = Process.GetProcesses(); foreach (Process process in processlist) { if (!String.IsNullOrEmpty(process.MainWindowTitle)) { Console.WriteLine("Process: {0} ID: {1} Window title: {2}", process.ProcessName, process.Id, process.MainWindowTitle); } } 

Solutions Collecting From Web of "使用vbscript访问窗口的标题"

 Dim Tasks Tasks = Split(WScript.CreateObject("WScript.Shell").Exec("tasklist /v /fo csv").StdOut.ReadAll(),vbCrLf) Dim task For Each task In Tasks task = Split(Trim(task),",") If Ubound(task) >= 8 Then WScript.Echo "Process " + task(0) + "ID: " + task(1) + " Title: " + task(8) End If Next