大致分为以下几步:
[ol]
netsh interface ip set address name="XXXXX" source=static addr=X.X.X.X mask=X.X.X.X
ssh [email protected]
xxxxxxx(密码)
cat /xxx/xxxxx/xxx.conf
[/ol]
在第四部会返回一个字符串(例如:lisi ),然后将该字符串作为第五步的参数:
[ol]
[/ol]
每次都得一步一步输入,感觉挺麻烦的,所以想要写成一个脚本,前几部可以使用 vb 来实现:
Dim WshShell
Set WshShell=WScript.CreateObject("WScript.Shell")
WshShell.Run "cmd.exe"
WScript.Sleep 1500
WshShell.SendKeys "netsh interface ip set address name='XXXXX' source=static addr=X.X.X.X mask=X.X.X.X"
WScript.Sleep 1500
WshShell.SendKeys "ssh [email protected]"
WshShell.SendKeys "{ENTER}"
WScript.Sleep 1500
WshShell.SendKeys "xxxxxxx"
WshShell.SendKeys "{ENTER}"
WScript.Sleep 1500
WshShell.SendKeys "cat /xxx/xxxxx/xxx.conf"
该如何接收第四步的返回值作为第五步的参数呢?
不懂 VB ,请大佬们帮忙,感谢感谢
wshshell, sendkeys, wscript, sleep