请教,如何在运行中VBS输入命令并执行
@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}"