Telnet Batch!


Vu Ngoc Son

Hi! Everyone. I want to connect to a several server by Telnet client and run
some similar command . Can I make a batch to do it insted of typing after
tel net to server?



Torgeir Bakken \(MVP\)

Vu said:
Hi! Everyone. I want to connect to a several server by Telnet
client and run some similar command . Can I make a batch to do
it insted of typing after tel net to server?

A previous post about this:

From: "Alex K. Angelopoulos \(MVP\)" <>
Subject: Re: Automate a telnet session
Date: Wed, 19 Feb 2003 17:46:01 -0500
Newsgroups: microsoft.public.scripting.vbscript,


There's no native automated telnet tool. It is theoretically somewhat
possible with a screenscraper and the NT4-era telnet client, but the
newer one doesn't work worth a diddle due to various oddities such as
screen control characters.

There are several telnet clients which can be automated; the "free"
ones include most prominently feature TeraTerm, IVT, and TelScript;
below is my quote of Torgeir quoting me on the three tools, for people
in windows.server.scripting (did I really say all this?<g>) :

.....There are several which are commercially available; the 2 which I
use consistently are TeraTerm Pro and IVT Telnet. is the home page
for TeraTerm; it is open and easy to use, but is beginning to age.
IVT telnet is alive and kicking and has just gone "semi-commercial" -
if you don't need Kerberos support, you can get it for free also.

and then we have this one ;-)

From: Alex K. Angelopoulos \(MVP\) (
Subject: Telnet from WSH - AND IT'S ABOUT FLIPPIN' TIME!!!!!
Newsgroups: microsoft.public.scripting.wsh
Date: 2002-10-25 19:28:03 PST


As for scripts to handle this, the TeraTerm ones are easy. The web
server I use is experimental and is not listening for uploads right
now, so I can't get my TTL scripts transferred, but a short set will
be there "soon" at

In the interim, here's a TeraTerm script that logs on to a Win2K server
via Telnet and does a password change. Details of the logon sequence
and characters to wait for will vary depending on the OS/type of the
system to which you connect.

; 1 - we set variables - prompts and the passwords
UsernamePrompt = 'login:'
Username = 'administrator'
PasswordPrompt = 'password:'
;Current password
;New password (assumes a password change)
Password = 'modron'
NewPassword = 'modron'
;this is the LOCAL log file
PathtoLogFile = 'c:\data\logs\w2klog.txt'

;2 - we connect
connect param2

;3 - then we log in
wait UsernamePrompt
sendln Username
wait PasswordPrompt
sendln Password

;4 - wait for the w2k prompt; if it doesn't come in 5 seconds,
; assume its OK
wait '>'

;5 - Login is done, so we start a log, 0 for text not binary,
; 1 for append not overwrite
logopen PathtoLogFile 0 1

;6a - Kludge - since I can't echo params to log,
' we'll do an ipconfig to capture address
sendln 'ipconfig'
wait '>'

;6b - Now we do the password change and exit
sendln 'net user ' Username ' *'
wait 'user:'
sendln NewPassword
wait 'confirm'
sendln NewPassword
wait '>'
sendln 'exit'

;7 - Stop logging



Dec 21, 2008
Reaction score
You can use NTAutoScript for a try.

email to (e-mail address removed)
i send you a copy

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Telnet batch 3
batch commands in side telnet session 1
telnet problem 2
telnet recommendation 2
Telnet sessions with parameters 2
Automating telnet logon 6
scripting a telnet session 1
remapping altkeys for telnet 10