2013-08-07 100 views
0

下面的VB腳本打開CMD窗口執行ping到IP - 127.0.0.1打開CMD窗口,然後運行命令

我不明白,爲什麼在CMD窗口輸出只包括從平的結果,而不是還「ping 127.0.0.1」?

我的問題有什麼需要我的VB腳本改變以便也能看到從CMD窗口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看到僅僅是:(平127.0.0.1不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 
+0

爲什麼不直接使用一個批處理文件? –

+0

我使用已經沿着VB腳本的鱈所以這個選項不相關 – maihabunash

+2

你可以使用「CMD/K @echo平127.0.0.1和Ping 127.0.0.1」。該CD不是必需的(實際上由於目錄名稱中的空間而不起作用)。 –

回答

0

「平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 
相關問題