共用方式為


Telnet Client Startup Parameter Reference

Applies To: Windows 7, Windows Server 2008, Windows Server 2008 R2, Windows Vista

You can create a Telnet connection and configure some Telnet.exe options by using the Telnet command in conjunction with various command-line parameters. Using the Telnet command with command-line parameters is helpful if you are creating Telnet connections within a script or batch file or if you do not need to use advanced Telnet client options and features. When you use Telnet with command-line parameters, you can use a single command to create a connection with a host. The command-line syntax for Telnet.exe is:

telnet [-a] [-e EscapeChar] [-f LogFile] [-l UserName] [-t Term] [TelnetServer] [Port]

The command-line parameters are described in the following table.

Telnet.exe Command-Line Parameters

Parameter Description

-a

Instructs Telnet.exe to log on to the host by using the credentials of the user who is currently logged on to the client.

-e EscapeChar

Specifies an escape character, which displays the Telnet command prompt. The default escape character is Ctrl+].

-f LogFile

Creates a client-side log file and turns on client-side logging for the current session. The LogFile parameter must consist of a path and file name.

-l UserName

Instructs Telnet.exe to log on to the host by using the user account that is specified in UserName. The user account specified in UserName must have Telnet logon rights on the host.

-t Term

Specifies the terminal type. The default terminal type is ANSI. Other valid terminal types include VT52, VT100, and VTNT.

TelnetServer

Specifies the host with which you want to create a Telnet connection. The TelnetServer parameter can be a NetBIOS name, a fully qualified domain name, or an IP address.

Port

Specifies the TCP port on which you want to create a Telnet connection. The default Telnet port is 23.

Quit

Closes Telnet Client.

For example, the following command uses the credentials of the user who is currently logged on to the client to create a Telnet connection on port 23 with a host named server01:

telnet server01

Likewise, the following example creates the same Telnet connection and enables client-side logging to a log file named c:\telnet_logfile.txt:

telnet -f c:\telnet_logfile.txt server01

The connection with the host remains active until you exit the Telnet session (by using the Quit command), you use the Telnet Server administration tool to terminate the Telnet session on the host, or the connection is disconnected by the server due to an idle time-out.

See Also

Concepts

Telnet Client Command Reference
Telnet Server Admin Tool TlntAdmn.exe Command Line Reference
Telnet Registry Entries
Telnet Errors and Events
RFCs Supported by the Microsoft Implementation of Telnet