• 欢迎访问奇跡の海网站,本站不上传任何资源,所有资源均来自于网络,欢迎加入奇跡の海~!奇跡の海-WordPress QQ群
  • 本站下载资源为网络上收集整理而来,并且以计算机技术研究交流为目的,版权归原作者所有,仅供大家参考,学习,不存在任何商业目的与商业用途.
  • 本站系统镜像均来自于官方原版,ed2k可视为P2P下载链接。所有操作系统默认均为试用版,如有正版密钥可以有效激活,本站不提供任何激活和相关服务。

用批处理实现telnet登陆并进行一些简单命令

批处理 奇跡の海 2年前 (2017-03-13) 507次浏览 已收录 0个评论 扫描二维码

具体如下命令
先登陆到192.168.1.100.
telnet 192.168.0.100
Username:aaa
Password:111
登陆之后做几个简单的ping操作
ping 192.168.0.1
ping 192.168.0.2
请问用cmd的批处理如何实现?

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

rem =========Yobo-lily版权=======
@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.100">>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"aaa">>c:\temp.vbs
@echo WshShell.SendKeys"{ENTER}">>c:\temp.vbs
@echo WScript.Sleep 2000>>c:\temp.vbs
@echo WshShell.SendKeys"111">>c:\temp.vbs
@echo WshShell.SendKeys"{ENTER}">>c:\temp.vbs
@echo WScript.Sleep 2000>>c:\temp.vbs
@echo WshShell.SendKeys"ping 192.168.0.1">>c:\temp.vbs
@echo WshShell.SendKeys"{ENTER}">>c:\temp.vbs
@echo WScript.Sleep 1000>>c:\temp.vbs
@echo WshShell.SendKeys"ping 192.168.0.2">>c:\temp.vbs
@echo WshShell.SendKeys"{ENTER}">>c:\temp.vbs
@echo WScript.Sleep 1000>>c:\temp.vbs
@call c:\temp.vbs 
rem =========Yobo-lily版权=======
rem =========Yobo-lily版权=======
@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.100">>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"aaa">>c:/temp.vbs
@echo WshShell.SendKeys"{ENTER}">>c:/temp.vbs
@echo WScript.Sleep 2000>>c:/temp.vbs
@echo WshShell.SendKeys"111">>c:/temp.vbs
@echo WshShell.SendKeys"{ENTER}">>c:/temp.vbs
@echo WScript.Sleep 2000>>c:/temp.vbs
@echo WshShell.SendKeys"ping 192.168.0.1">>c:/temp.vbs
@echo WshShell.SendKeys"{ENTER}">>c:/temp.vbs
@echo WScript.Sleep 1000>>c:/temp.vbs
@echo WshShell.SendKeys"ping 192.168.0.2">>c:/temp.vbs
@echo WshShell.SendKeys"{ENTER}">>c:/temp.vbs
@echo WScript.Sleep 1000>>c:/temp.vbs
@call c:/temp.vbs 
rem =========Yobo-lily版权=======

版权声明:本站所有文章和资源使用CC BY-NC-SA 4.0协议授权发布 , 转载应当以相同方式注明文章来自“SeaOMC.COM->用批处理实现telnet登陆并进行一些简单命令!在下边可以分享本文哦!
喜欢 (0)
[]
分享 (0)
奇跡の海
关于作者:
一个WordPress菜鸟!
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址