Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Teach me on Telnet script

Here is my situation. I am using a Motorola Canopy. Every time I shut down my PC or power off the modem, the ESN of my Canopy changes back from its default value.

I have been running telnet again and again on boot-up to have my Internet connection working. I want a batch file to do the job so that I don't have to run telnet again and again. I am using Windows 7 32-bit.

Here are the details:

  • Canopy telnet is 169.254.1.1 (it has no password whatsoever)
  • The ESN that I'm trying to place is db:68:d3

Manually I can do it using this script:

telnet 169.254.1.1
mac db:68:d3

and it's done..

If someone here can help me and make me this script it will be a great help. I have made a simple script here, but the problem is it stops on telnet:

cd \
rem .
COLOR 0E
@ECHO OFF
cls
ECHO Change ESN
pause
ECHO ARE YOU SURE YOU WANT TO PROCEED? 
pause
ECHO ARE YOU SURE?
pause
telnet 169.254.1.1 >>>>>>>>>>>>>>>>>>>>>>>>>>>>after this the script below doesn't follow.
testing
enable
telnet+> mac db:68:d3
ECHO You have Changed ESN successfuly
ECHO Done.
Echo 
like image 559
Kris_aquino Avatar asked Mar 12 '26 13:03

Kris_aquino


1 Answers

You cannot do it with bat files, but you can do it with windows scripting & vbscript, which should be also available by default. Save this as autoscript.wsf (.wsf is a windows scripting file):

<job>
<script language="VBScript">
Option Explicit
On Error Resume Next
Dim WshShell
set WshShell=CreateObject("WScript.Shell")
WshShell.run "cmd.exe"
WScript.Sleep 1000
WshShell.SendKeys "telnet 169.254.1.1"
WshShell.Sendkeys("{Enter}")
WScript.Sleep 1000
WshShell.SendKeys "mac db:68:d3"
WshShell.Sendkeys("{Enter}")
WScript.Sleep 1000
WshShell.SendKeys "exit"
WshShell.SendKeys ("{Enter}")
WScript.Quit 
</script>
</job>

and call it from your bat file

call autoscript.wsf

or just run directly

C:\> autoscript.wsf
like image 180
eis Avatar answered Mar 15 '26 08:03

eis



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!