编写一个bat文件。可以实现telnet自动输入帐号和密码

2024-12-02 11:21:50
推荐回答(1个)
回答1:

把如下代码保存为批处理(*.bat)

rem ================
@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.1">>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
@call c:\\temp.vbs
rem ================