I'm trying to control a wifi device with a batch script using the telnet command in Windows 7, but I don't know how to pass the commands to the telnet window. This will be a part of a longer script tweaking other devices and PC settings.
I can do this manually by running telnet <IP address> 55443
in cmd.exe, which creates a new window. In that window, I can write the commands for the device and it works as intended. However, when I write the code in the script, like this:
telnet <IP address> 55443
<device commands>
The <device commands>
are not passed on to the newly created telnet window.
Best Answer
The telnet command does not offer many options for entering some commands...
I will leave here two possible options
To do it in bat/cmd with vbs
To do it with the software console called Telnet Script Tool
One option would be to use SendKey/VBS very useful for sending keys, commands etc., will send your entries/type send them to telnet interfaces instance/session...
Below an example of using SendKey/VBS to send login/input data by bat file and which generates in runtime the file VBS to perform this task.
To correct this, apply this command on the command line (this requires administrator rights) and run this command only once
Telnet Scripting Tool is a utility to automate telnet sessions (like calling dip on a Linux system, or doing router maintenance for example).
The Telnet Script Tool can also send entries to telnet...
Basically, this software reads the screen and looks for a prediction string that you will inform for waiting until the next command to be sent to telnet by the software...
Below is an example of using the Telnet Script Tool that send command inputs by using content of a text file: "%temp%\script_ts.scr"
To use
Send Key
in your command with many special characters, you need to escape{:)}