You can't use standard .bat scripts to automate telnet commands. This can be done via a simple VB Script.
To create a VBScript, simply create a plain text (.txt) file and change extension to .vbs



Following example will connect to a Draytek Vigor router and issue WOL command  to wake up a remote computer.


' Open Telnet and connect to 82.101.68.207
set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.run("telnet.exe 82.91.58.209")
' Wait 500 ms
WScript.Sleep 500
' "Type" Password
WshShell.SendKeys"Password"
' "Press" Enter
WshShell.SendKeys("{Enter}") ' Wait 500 ms WScript.Sleep 500 ' "Type" "wol up 001D097FB6C1" WshShell.SendKeys"wol up 001D097FB6C1" ' "Press" Enter WshShell.SendKeys("{Enter}")


On Windows 7 machines, telnet.exe is not automatically installed. You can add it via Turn Windows Features on or off in Control Panel > Programs.

No comments

Leave your comment

In reply to Some User
Captcha Image