[操作系统]Remote Desktop File Format
The new Terminal Services client (version 2600 and newer, 5.1.2600.x) introduces quite a few new capabilities. A major client-side convenience is that connection settings can be saved in an RDP file which can then be easily edited, copied, and distributed.
Unfortunately, the parameters are not nearly as well documented as the ActiveX control parameters yet; this will presumably change before the .NET server release.
Which Terminal Services/Remote Desktop Client?
The newest ones, versions 5.1.2600.x and up. The client can be downloaded from the Remote Desktop Connection page - and despite the header, it is the client to use for connecting to either Terminal Services or XP Remote Desktop.
You can install it on any true 32-bit Windows OS except Windows XP and .NET - they already come with their own version.
Making an RDP File
You can create an RDP connection file using a text editor; there is nothing special about its structure to prevent this; in fact, the Terminal Services people appear to have been assiduous about making it simple and easy to use; the order in which parameters are placed doesn't even matter.
The simplest way to do it initially, though, is to run the mstsc client, configure basic settings you want, then choose "Save As..." on the General tab. You can then open the resulting file in Notepad and work with it.
RDP File Structure
The file structure is relatively simple. The standard file consists of several lines; each has parameter name, type, and value, separated by a ":". Any colons after the second one appear to be ignored (necessary so that file paths can be embedded). MSTSC also appears to silently ignore anything it cannot parse, so you can insert freeform comments into the file.
For example, here are two lines which tell MSTSC to establish a 1024x768 desktop when it connects:
The first element in each line is the parameter name. Immediately following it, after the first colon, is the parameter type; as far as I can tell, there are only 3 types of values -
- i (integer) This is used for numeric values such as the desktop resolutions above. All of the "on-off" values are integers; this may be to allow future expansion of value types, since some - such as audio redirection and keyboard hooking - actually have multiple values.
- s (string) Almost everything which is not a pure integer. This includes paths and server names
- b (binary) apparently only used for hashed password storage
RDP File Parameters
Below is a table listing all of the parameters I have encountered so far. I list the parameter name, type, an example value, and then include notes on usage where possible.
Sets the shell to be used within the Terminal Services session. This can be used to set an alternate shell such as progman.exe; you can also use it to set the application which the user runs on logon to the Terminal Server.
0 - Bring to this computer
1 - Leave at remote computer
2 - Do not play
0 or 1
Set to 1 to connect automatically when file is opened.
? 1 maintains bitmap cache between sessions
? 1 means use extra compressions
connect to console
0 - connect to a virtual session
1 - connect to the console session
height of session desktop in pixels
width of session desktop in pixels
disable cursor setting
disable full window drag
set to 1, disables display of window contents while dragging in session
disable menu anims
set to 1, disables menu animations in session
set to 1, disables use of themes in session
set to 1, disables display of wallpaper in session
Set to 1, displays the connection bar in a fullscreen session
domain name to use for logon
IP address/name of server (and optional alternate port)
For applying standard Windows key combinations
0 - On the local computer
1 - On the remote computer
2 - In fullscreen mode only
set to 1, maximizes any alternate shell used in the session
(big long binary hash)
Ifyou choose to save the connection password, this will be a large binary hash value
set to 1, redirects client COM ports in session (XP/.NET only)
set to 1, redirects client drives in session (XP/.NET only)
set to 1, redirects client printers in session
set to 1, redirects client smart cards in session (XP/.NET only)
screen mode id
FullScreen vs. normal
0 - ?
1 - windowed
2 - fullscreen
You can specify the port separately from the "full address" parameter. Thanks to James from acmewidgets.com for finding this out!
bit depth for session - 8, 16, or 24. Only 8 is valid for Windows 2000 Terminal Servers
shell working directory
c:\program files\microsoft office
Working directory if an alternate shell was specified.
Scale the client window display of desktop when resizing
0 or not present - Do not scale
1 - Scale (Takes extra resources to scale)
name of user logging on
? Not sure about the details on this one. There are always 6 comma-separated values. I would guess that these are presets for position and "window mode" sizes - maximized versus sized.
Example RDP File
This is an example RDP connection file. It starts maximized for its desktop size (800x600); color depth is 16-bit; it will attempt to automatically start connecting to 192.168.1.12 on launch; and so on...
screen mode id:i:1
shell working directory:s:
disable full window drag:i:1
disable menu anims:i:1