问题
I am attempting to write a batch file to open a telnet session , connect to router ,enter username and password and finally send a command to the router, I have two different routers I am attempting this with . one of them a netgear i can successfully unlock telnet on the router (it is locked by default and once unlocked ,reverts after reboot) open telnet session and connect to the router.to unlock telnet i have a program telnetenable.exe which is stored in c:/
echo off
echo c:/telnetenable.exe ipaddress username password
telnet ipaddress
but cant send a command to the router once at this point ,at which i have an open connection to the router and can enter cmd manually which is adslctl configure --snr x but i would like to incorporate it into the batch file.
on the second router a speedstream 4200 telnet is not locked and i can open the telnet session and connect to router but cant enter username or password after which i want to be able to send a cmd.
echo off
telnet ipaddress
gets me as far as username request. can anyone help me with either of these problems. many thanks.
回答1:
Search for this free tool. Windows telnet can't be scripted.
Telnet Scripting Tool v.1.0 by Albert Yale
来源:https://stackoverflow.com/questions/20887976/how-to-use-a-batfch-file-to-log-in-to-a-router-and-then-send-commands-to-the-rou