您好我正在努力完成一项简单的任务。当您打开命令提示符并键入此命令时,#34; net view / all" ,您将获得主机名和用户名列表。我如何在批处理文件或vbscript或php中完成此操作。我想将结果保存在单独的文本文件中。我在vb中试过这个但是可以得到所有
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