我有一个 VBScript,它可以 Telnet 到 Linux 设备,我想查看可用内存。以下命令产生“无效的过程调用或参数”错误。
WshShell.SendKeys"df /mnt/cf | awk '/mnt/{print$2}'"
如果我手动 telnet 进入设备并使用相同的命令,这将有效。有什么建议吗?
到目前为止的代码:
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}")