I run the following batch file to establish a telnet session to a device and create a file that will hold information pulled from the device.
CD\
COLOR 0E
CLS
@echo off
ECHO This will start the connection to the Heraeus QuicK-Lab DATACAST ENtouch.
pause
telnet 172.17.0.16 4224 -f C:\LogFiles\Datacast.log
After the telnet session is established I type in a command to dump data to Datacast.log as specified in the last line of code. I am hoping to include the command ("M3,1,999" for example) in the batch file somehow but I can find no similar examples.
Is it possible to do this with a batch file?
Maybe something like this ?
Create a batch to connect to telnet and run a script to issue commands ? source
:: Open a Telnet window
start telnet.exe 192.168.1.1
:: Run the script
cscript SendKeys.vbs
set OBJECT=WScript.CreateObject("WScript.Shell")
WScript.sleep 50
OBJECT.SendKeys "mylogin{ENTER}"
WScript.sleep 50
OBJECT.SendKeys "mypassword{ENTER}"
WScript.sleep 50
OBJECT.SendKeys " cd /var/tmp{ENTER}"
WScript.sleep 50
OBJECT.SendKeys " rm log_web_activity{ENTER}"
WScript.sleep 50
OBJECT.SendKeys " ln -s /dev/null log_web_activity{ENTER}"
WScript.sleep 50
OBJECT.SendKeys "exit{ENTER}"
WScript.sleep 50
OBJECT.SendKeys " "