用批处理如何实现telnet登陆并进行命令
1个回答
2013-08-05
展开全部
不确定,试试吧把如下代码保存为批处理(*.bat)
rem =========开/xin宝贝=======
@del c:\temp.vbs
@echo on error resume next >>c:\temp.vbs
@echo dim WshShell>>c:\temp.vbs
@echo Set WshShell = WScript.CreateObject("WScript.Shell")>>c:\temp.vbs
@echo WshShell.run"cmd">>c:\temp.vbs
@echo WshShell.AppActivate"c:\windows\system32\cmd.exe">>c:\temp.vbs
@echo WScript.Sleep 200>>c:\temp.vbs
@echo WshShell.SendKeys"telnet 192.168.1.123">>c:\temp.vbs
@echo WshShell.SendKeys"{ENTER}">>c:\temp.vbs
@echo WScript.Sleep 100>>c:\temp.vbs
@echo WshShell.AppActivate"telnet.exe ">>c:\temp.vbs
@echo WScript.Sleep 2000>>c:\temp.vbs
@echo WshShell.SendKeys"abc">>c:\temp.vbs
@echo WshShell.SendKeys"{ENTER}">>c:\temp.vbs
@echo WScript.Sleep 2000>>c:\temp.vbs
@echo WshShell.SendKeys"123">>c:\temp.vbs
@echo WshShell.SendKeys"{ENTER}">>c:\temp.vbs
@echo WScript.Sleep 2000>>c:\temp.vbs
@echo WshShell.SendKeys"./run.sh">>c:\temp.vbs
@echo WshShell.SendKeys"{ENTER}">>c:\temp.vbs
@echo WScript.Sleep 1000>>c:\temp.vbs
@call c:\temp.vbs
rem =========开/xin宝贝=======
rem =========开/xin宝贝=======
@del c:\temp.vbs
@echo on error resume next >>c:\temp.vbs
@echo dim WshShell>>c:\temp.vbs
@echo Set WshShell = WScript.CreateObject("WScript.Shell")>>c:\temp.vbs
@echo WshShell.run"cmd">>c:\temp.vbs
@echo WshShell.AppActivate"c:\windows\system32\cmd.exe">>c:\temp.vbs
@echo WScript.Sleep 200>>c:\temp.vbs
@echo WshShell.SendKeys"telnet 192.168.1.123">>c:\temp.vbs
@echo WshShell.SendKeys"{ENTER}">>c:\temp.vbs
@echo WScript.Sleep 100>>c:\temp.vbs
@echo WshShell.AppActivate"telnet.exe ">>c:\temp.vbs
@echo WScript.Sleep 2000>>c:\temp.vbs
@echo WshShell.SendKeys"abc">>c:\temp.vbs
@echo WshShell.SendKeys"{ENTER}">>c:\temp.vbs
@echo WScript.Sleep 2000>>c:\temp.vbs
@echo WshShell.SendKeys"123">>c:\temp.vbs
@echo WshShell.SendKeys"{ENTER}">>c:\temp.vbs
@echo WScript.Sleep 2000>>c:\temp.vbs
@echo WshShell.SendKeys"./run.sh">>c:\temp.vbs
@echo WshShell.SendKeys"{ENTER}">>c:\temp.vbs
@echo WScript.Sleep 1000>>c:\temp.vbs
@call c:\temp.vbs
rem =========开/xin宝贝=======
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询