无忧启动论坛
标题:
请教,怎么在VBS运行telnet输入命令后并执行
[打印本页]
作者:
huntercj1981
时间:
2013-6-8 19:18
标题:
请教,怎么在VBS运行telnet输入命令后并执行
@echo off
echo set sh=WScript.CreateObject("WScript.Shell") >telnet_tmp.vbs
echo WScript.Sleep 300 >>telnet_tmp.vbs
echo sh.SendKeys "open 192.168.1.1" >>telnet_tmp.vbs
echo WScript.Sleep 300 >>telnet_tmp.vbs
echo sh.SendKeys "{ENTER}" >>telnet_tmp.vbs
echo WScript.Sleep 300 >>telnet_tmp.vbs
echo sh.SendKeys "c3650{ENTER}">>telnet_tmp.vbs
echo WScript.Sleep 300 >>telnet_tmp.vbs
echo sh.SendKeys "en{ENTER}">>telnet_tmp.vbs
echo WScript.Sleep 300 >>telnet_tmp.vbs
echo sh.SendKeys "c3650{ENTER}">>telnet_tmp.vbs
echo WScript.Sleep 300 >>telnet_tmp.vbs
echo sh.SendKeys "config term{ENTER}" >>telnet_tmp.vbs
echo WScript.Sleep 300 >>telnet_tmp.vbs
echo sh.SendKeys "ip access-list standard web{ENTER}" >>telnet_tmp.vbs
echo Dim ip >>telnet_tmp.vbs
echo ip = inputbox("把IP输进去","请注意") >>telnet_tmp.vbs
echo WScript.Sleep 300 >>telnet_tmp.vbs
echo sh.SendKeys "exit{ENTER}" >>telnet_tmp.vbs
echo WScript.Sleep 300 >>telnet_tmp.vbs
echo sh.SendKeys "exit{ENTER}" >>telnet_tmp.vbs
echo WScript.Sleep 300 >>telnet_tmp.vbs
echo sh.SendKeys "exit{ENTER}" >>telnet_tmp.vbs
echo WScript.Sleep 300 >>telnet_tmp.vbs
echo set ws=createobject("wscript.shell") >>telnet_tmp.vbs
echo ws.run "taskkill /f /im ping.exe",hide >>telnet_tmp.vbs
echo WScript.Sleep 300 >>telnet_tmp.vbs
echo set ws=createobject("wscript.shell") >>telnet_tmp.vbs
echo ws.run "taskkill /f /im telnet.exe",hide >>telnet_tmp.vbs
echo sh.SendKeys "quit{ENTER}" >>telnet_tmp.vbs
start telnet
cscript //nologo telnet_tmp.vbs
最近用批出做了一个思科交换机公司电脑上网权限的脚本,想实现执行过程中手动输入 permit 192.168.1.197 就开放指定IP的上网权限,现在输入后无法执行,就是上面代码空行那里,请教各位高手要怎么改,谢谢!
Vbs
set sh=WScript.CreateObject("WScript.Shell")
WScript.Sleep 300
sh.SendKeys "open 192.168.1.1"
WScript.Sleep 300
sh.SendKeys "{ENTER}"
WScript.Sleep 300
sh.SendKeys "c3650{ENTER}"
WScript.Sleep 300
sh.SendKeys "en{ENTER}"
WScript.Sleep 300
sh.SendKeys "c3650{ENTER}"
WScript.Sleep 300
sh.SendKeys "config term{ENTER}"
WScript.Sleep 300
sh.SendKeys "ip access-list standard web{ENTER}"
Dim ip
ip = inputbox("把IP输进去","请注意")
WScript.Sleep 300
sh.SendKeys "exit{ENTER}"
WScript.Sleep 300
sh.SendKeys "exit{ENTER}"
WScript.Sleep 300
sh.SendKeys "exit{ENTER}"
WScript.Sleep 300
set ws=createobject("wscript.shell")
ws.run "taskkill /f /im ping.exe",hide
WScript.Sleep 300
set ws=createobject("wscript.shell")
ws.run "taskkill /f /im telnet.exe",hide
sh.SendKeys "quit{ENTER}"
作者:
pznpt
时间:
2013-6-9 09:26
这样?
echo Dim ip >>telnet_tmp.vbs
echo ip = inputbox("把IP输进去","请注意") >>telnet_tmp.vbs
echo WScript.Sleep 300 >>telnet_tmp.vbs
echo sh.SendKeys ip ^& "{ENTER}" >>telnet_tmp.vbs
echo WScript.Sleep 300 >>telnet_tmp.vbs
复制代码
作者:
怕猫的鱼
时间:
2013-7-9 10:37
提示:
作者被禁止或删除 内容自动屏蔽
欢迎光临 无忧启动论坛 (http://wuyou.net/)
Powered by Discuz! X3.3