我有一個VBScript的Telnet到Linux設備,我希望看到可用的內存。以下命令會產生「無效的過程調用或參數」錯誤。在VBScript中使用AWK的正確語法是什麼?
WshShell.SendKeys"df /mnt/cf | awk '/mnt/{print$2}'"
如果我手動遠程登錄到設備並使用相同的命令,這將起作用。有什麼建議?
到目前爲止的代碼:
Dim WshShell
Set WshShell = CreateObject("WScript.Shell")
WshShell.run"cmd"
'*** open command window ***
WScript.Sleep 250 WshShell.SendKeys("{Enter}")
WshShell.SendKeys"telnet 10.13.2.2 -f VBSmemSize.txt"
WshShell.SendKeys("{Enter}")
WScript.Sleep 2000
WshShell.SendKeys"root"
WshShell.SendKeys("{Enter}")
WScript.Sleep 1500
WshShell.SendKeys"password"
WshShell.SendKeys("{Enter}")
WScript.Sleep 1500
WshShell.SendKeys"df /mnt/cf |awk '/mnt/{print$2}'"
WshShell.SendKeys("{Enter}")
我更新了你的問題,包括你送我您的評論 –