1

以下 VB 脚本打开 CMD 窗口并执行 ping 到 IP – 127.0.0.1

我不明白为什么 CMD 窗口的输出只包括 ping 的结果而不包括“ping 127.0.0.1”?

我的问题需要在我的 VB 脚本中进行哪些更改才能从 CMD 窗口中看到 ping 命令,而不仅仅是 ping 结果?

我的 VB 脚本:

 Dim oShell
 Set oShell = WScript.CreateObject ("WScript.Shell")
 oShell.run "cmd /k CD C:\Program Files & ping 127.0.0.1   " ,1 , true

我从 CMD 看到的只是:( ping 127.0.0.1 not apears ?)

Pinging 127.0.0.1 with 32 bytes of data:
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Ping statistics for 127.0.0.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
4

1 回答 1

1

“ping 127.0.0.1”是一个批处理文件命令。如果您点击开始按钮,输入“命令提示符”,打开命令提示符并输入该命令,那么您将获得与我所得到的内容一致的输出。

Pinging 127.0.0.1 with 32 bytes of data:
Reply from 127.0.0.1: bytes=32 time<1ms TTL-128
Reply from 127.0.0.1: bytes=32 time<1ms TTL-128
Reply from 127.0.0.1: bytes=32 time<1ms TTL-128
Reply from 127.0.0.1: bytes=32 time<1ms TTL-128

Ping statistics for 127.0.0.1:
     Packets: Sent = 4, Received =  4, lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms
于 2017-02-05T18:06:40.537 回答