Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

At times I find myself telnetting from Windows XP to another server and that I state a wrong port number such as

c:\> telnet xxxxx.yy pp

After hitting Enter, I realize that I entered the wrong port number and would like to abort the telnet process with a ctrl-c, however, telnet doesn't seem to respond even to ctrl-c. So, I have to wait a few seconds until telnet returns with a

Connecting to xxxxx.yy... 
Could not open connection to the host, on port pp: Connect failed

It's rather annoying to wait for the error message, especially when I already know it will eventually come.

So, is there a way to immediately stop the telnet process?

share|improve this question
    
right, good point. updated answer. –  quack quixote Nov 14 '09 at 12:04

1 Answer 1

up vote 3 down vote accepted

Edit: Of course, it's never that simple. As you've observed, Microsoft's telnet doesn't respond to ^] while waiting for a connection.

If you don't want to wait around, you only have two options:

  • Kill the telnet process (from another command shell or the task manager), or

  • Use another telnet client. PuTTY is a good choice, since it will launch as a separate window; even if you get the port wrong and the PuTTY window freezes, your command shell will be available to launch another instance with the correct port number.


Use the escape character (defaults to Ctrl+]). This brings up a telnet prompt at which you can close or quit the connection.

> telnet

Welcome to Microsoft Telnet Client

Escape Character is 'CTRL+]'

Microsoft Telnet>

You can change this to nearly anything you like on your commandline by using the -e flag:

C:\>telnet /?

telnet [-a][-e escape char][-f log file][-l user][-t term][host [port]]
[...]
 -e      Escape character to enter telnet client prompt.
[...]

C:\>telnet -e '

Welcome to Microsoft Telnet Client

Escape Character is '''

Microsoft Telnet>
share|improve this answer
    
The problem is: telnet doesn't respond to ctrl-] while it is in the process of connecting to the server. –  René Nyffenegger Nov 14 '09 at 11:06
4  
which pretty much means it won't respond to anything. bad telnet client, bad. –  quack quixote Nov 14 '09 at 12:06
    
Just curious: what escape-character did you try with the -e flag? A newline? A backspace? –  Arjan Nov 14 '09 at 12:44
    
me? single-quote ('), exactly as shown. that output was captured from a winXP cmd.exe terminal. –  quack quixote Nov 14 '09 at 16:01
    
Ahhh, I thought the single quote in telnet -e ' was the opening quote for something, like in telnet -e 'q'. Confused by the syntax highlighting I guess. :-) –  Arjan Nov 14 '09 at 18:24

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.