如何运行cmd命令,使用批处理或vbscript获取网络中的所有IP地址并保存到文本文件

Hi i am tryin to accomplish a simple task. When you open command prompt and type this command "net view /all" , You get a list of host name and usernames. How can i accomplish this in batch file or vbscript or php. I want to then save the results in a separate text file. i tried this in in vb but can get all

dim NIC1, Nic, StrIP, CompName

    Set NIC1 = GetObject("winmgmts:").InstancesOf("Win32_NetworkAdapterConfiguration")

    For Each Nic in NIC1

    if Nic.IPEnabled then

    StrIP = Nic.IPAddress(i)

    Set WshNetwork = WScript.CreateObject("WScript.Network")

    CompName= WshNetwork.Computername

    MsgBox "IP Address:  "&StrIP & vbNewLine _
    & "Computer Name:  "&CompName,4160,"IP Address and Computer Name"

    wscript.quit

    end if

    next