function Runcmd(cmd)  Dim strText   Set oShell = CreateObject("WScript.Shell")    Set oExec = oShell.exec("%COMSPEC% /C "&cmd)        Do While Not oExec.StdOut.AtEndOfStream        strText = oExec.StdOut.ReadAll()    Loop        Runcmd = strtextend function


用法很简单,例如

a=runcmd("ipconfig")

那么ipconfig的命令结果会保存在变量a中。