Computing.Net > Forums > Programming > Telnet script or batch file

Telnet script or batch file

Reply to Message Icon

Original Message
Name: buckethead (by coleg)
Date: February 21, 2008 at 08:37:15 Pacific
Subject: Telnet script or batch file
OS: Windows
CPU/Ram: 1 GB
Model/Manufacturer: HP Compaq
Comment:

I want to build a script or a batch file that I can set to run on a daily basis that will telnet to a device and then send commands to it. Basically it would need to telnet and then run a command and exit out of the device. I was thinking I could do this with a batch file and run it as a Scheduled task. Any help would be greatly appreciated.

I like long walks, especially when they are taken by people who annoy me.


Report Offensive Message For Removal


Response Number 1
Name: tonysathre
Date: February 21, 2008 at 13:15:02 Pacific
Subject: Telnet script or batch file
Reply: (edit)

You can't script telnet without expect.exe. You could also use netcat (nc.exe), which would probably be easier. With netcat you can redirect a text file with all your telnet commands in it to nc.exe like this,

nc ip_address -p 23 < cmds.txt


Report Offensive Follow Up For Removal

Response Number 2
Name: ghostdog
Date: February 22, 2008 at 07:43:15 Pacific
Subject: Telnet script or batch file
Reply: (edit)

A slight correction. You can also script telnet using more advanced scripting languages like Perl/Python etc, which provides better program control , like exceptions etc..


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Telnet script or batch file

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software




How often do you use Computing.Net?

Every Day
Once a Week
Once a Month
This Is My First Time!


View Results

Poll Finishes In 3 Days.
Discuss in The Lounge