In windows, there are two basic types of Telnet. The GUI telnet that comes with 16bit Windows (3.11, 98, Me) and the CMD line telnet that comes with 32bit Windows (2000, XP). For some strange reason, Windows NT comes with the GUI telnet, but you can run the command line version on NT just fine.
Unlike *nix telnet applications, the Microsoft versions do NOT lend themselves to scripting at all. This appears to be an attempt by Microsoft to improve security or prevent hacking. As far as I can see, the following is the only solution to scripting telnet on the GUI version.
From: William Allen (_invalid_@mayfly13.fsnet.co.uk) Subject: Re: telnet batch file View: Complete Thread (9 articles) Original Format Newsgroups: alt.msdos.batch Date: 2003-02-03 00:17:46 PST "Soenke Schreiber" wrote in message ...snip > I'm looking for a batch file that enables me to pass several parameters via > telnet, i.e. to execute several steps (commands) via a telnet connection to > a remote host. Here are two methods: (a) Use the SendKeys method of WSH (Windows Script Host) (See Note 1) This demo shows how to send a few keypresses to the Windows TelNet client to start a connection to a remote host. You must add further commands to the SendKeys Script in _TEMP.VBS ====Begin cut-and-paste (omit this line) @ECHO OFF :: Create SendKeys script ECHO.set sh=WScript.CreateObject("WScript.Shell")>_TEMP.VBS ECHO.WScript.Sleep 1000 >>_TEMP.VBS :: Send Alt-C for menu item Connect ECHO.sh.SendKeys "%%C" >>_TEMP.VBS ECHO.WScript.Sleep 1000 >>_TEMP.VBS :: Send R for sub-item Remote system ECHO.sh.SendKeys "R" >>_TEMP.VBS ECHO.WScript.Sleep 1000 >>_TEMP.VBS :: Send Host Name ECHO.sh.SendKeys "some.telnet.site" >>_TEMP.VBS ECHO.WScript.Sleep 1000 >>_TEMP.VBS :: Send Alt-C to press Connect button ECHO.sh.SendKeys "%%C" >>_TEMP.VBS :: Open a Telnet window - it will be the window with focus start /r TELNET.EXE :: Run the script to send keys to Telnet window cscript//nologo _TEMP.VBS :: Clear away workfile DEL _TEMP.VBS ====End cut-and-paste (omit this line) Win9x GUI study/demo only. Cut-and-paste as Batch script (file with .BAT extension). Lines that don't begin with 2 spaces have wrapped by mistake. The character codes for SendKeys are fully explained in the very detailed documentation of Windows Script Host. (b) Alternatively, use a scriptable TelNet client You could try the Tera Term (originally commercial software) scriptable Telnet client. This is now freeware (but with no support). The Zip package includes several example Macros, including one for automatic login to a remote server (LOGIN.TTL). The package includes an explanation of the Tera Term macro language. The package includes instructions to associate Macro files with the Macro execution module, so you can run an entire automated Telnet session by double-clicking a Macro file if you wish. Tera Term ZIP package from: http://hp.vector.co.jp/authors/VA002416/teraterm.html -- William and Linda Allen Learn to write Batch Files on your Win95/98/ME PC. Free, interactive Web Course. Syllabus and Index to Lessons: http://www.allenware.com/ Note 1 WSH (Windows Script Host) enables routine tasks to be handled in either VBScript or JScript. It's available as a free downloadable add-on for the tiny proportion of Windows machines (mostly older Windows 95 ones) which don't already have it (in one version or another). Documentation is included as an HTML help file, and includes cut-and-pastable syntax examples in VBScript and JScript for all features. Windows Script Host information/upgrade-to-current-version/downloads: http://msdn.microsoft.com/scripting/ By default, WSH installs CSCRIPT.EXE which is a Batch file interface allowing all WSH functionality to be run from a normal DOS-style Batch file. This interface provides Windows machines with a massive extension to the traditional Batch functionality.
file: /Techref/app/inet/telnet.htm, 4KB, , updated: 2004/8/16 12:22, local time: 2024/12/28 22:57,
18.119.19.219:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://ecomorder.com/Techref/app/inet/telnet.htm"> Telnet Application </A> |
Did you find what you needed? |
Welcome to ecomorder.com! |
Welcome to ecomorder.com! |
.