Windows

Launching remote desktop from the command line in Windows XP Pro

Remote desktop allows you to configure and connect to another computer running Windows XP Pro. Here's what you need to know about the remote desktop connection dialog box, including a few parameters you're most likely to encounter.

The Windows XP remote desktop connection dialog box provides you with everything that you need to configure and connect to another computer running Windows XP Pro. You can use the Save As button on the Connection Settings panel to save all your connection settings as an RDP file. Then, you can launch and connect to a remote computer simply by double-clicking the RDP file.

You can also script a remote desktop connection, as Windows XP's remote desktop connection has an executable file that can accept command line parameters and be run from a batch file. The remote desktop connection executable file is MSTSC.EXE, and the following are some of the most common parameters:

  • /v:<computername>--specifies the name of the computer to connect to.
  • /f--starts the connection in a full screen.
  • /w:<width>--specifies the width of the remote desktop screen.
  • /h:<height>--specifies the height of the remote desktop screen.

For example, to remotely connect to a computer named Kaltec in a 640 x 480 remote desktop screen, you would use the following command:

mstsc /v: Kaltec /w:640 /h:480

You can type this command line in the Run dialog box, as well as use it in a batch file.

Note: This tip applies only to Windows XP Professional.

Miss a tip?

Check out the Windows XP archive, and catch up on our most recent Windows XP tips.

Stay on top of the latest XP tips and tricks with our free Windows XP newsletter, delivered each Thursday. Automatically sign up today!

About

Greg Shultz is a freelance Technical Writer. Previously, he has worked as Documentation Specialist in the software industry, a Technical Support Specialist in educational industry, and a Technical Journalist in the computer publishing industry.

23 comments
AaronShim
AaronShim

Also works on Vista by the way. Aaron

adverse
adverse

fire up command prompt, goto C:\windows\System32 note: windows is the default xp installation folder. There type mstsc.exe /? for a list of all the commands you can use with remote desktop, Cheers.

Greg Shultz
Greg Shultz

Since this article went to press, Microsoft has released an update to Remote Desktop. The update is officially called Remote Desktop Connection (Terminal Services Client 6.0) and is designed to provide access to any of the new Terminal Services features introduced in Microsoft Windows Vista and Microsoft Windows Server ?Longhorn? from a computer running Microsoft Windows XP with Service Pack 2 or Microsoft Windows Server 2003 with Service Pack 1. The following are new features found in this Remote Desktop Connection update: * Network Level Authentication - Network Level Authentication is a new authentication method that finishes user authentication before you establish a full Remote Desktop Connection and the logon screen appears. * Server authentication - Server authentication verifies that you are connecting to the correct remote computer or server. This security measure helps prevent you from connecting to a different computer or server than you intend. This also prevents you from unintentionally exposing confidential information. * Resource redirection - The Remote Desktop Connection 6.0 client update helps you redirect Plug and Play devices that support redirection. Terminal Services Gateway (TS Gateway) servers - A Terminal Services Gateway (TS Gateway) server is a type of gateway that enables authorized users to connect to remote computers on a corporate network. These authorized users can connect from any computer by using an Internet connection. TS Gateway uses the Remote Desktop Protocol (RDP) together with the HTTPS protocol to help create a more secure, encrypted connection. * TS Remote Programs - TS Remote Programs is a feature of Windows Server Terminal Services that lets client computers connect to a remote computer and use programs that are installed on it. * Monitor spanning - Remote Desktop Connection supports high-resolution displays that can be spanned across multiple monitors. However, the total resolution on all monitors must be under 4,096 x 2,048. * Visual improvements - Remote Desktop Connection now supports 32-bit color and font smoothing. This update als brings several new switches to the command line. You can learn more about the Remote Desktop update by visiting the Microsoft Web site and reading "Remote Desktop Connection 6.0 client update is available for download in the Microsoft Download Center" http://support.microsoft.com/kb/925876

philthee
philthee

This works on XP Home too .... I use it every day to connect from home to my XP Pro desktop at the office.

gdunger
gdunger

I believe you can run a client on any Windows computer (at least as far back as Win 98). If the server is XP, then it has to be XP Pro. This gets worse with Vista since it seems like you need a very expensive version to get Remote Desktop Server. (So I won't be upgrading my MCEdition.) Too bad. I was impressed with the performance. Oh well, can always use VNC.

IT_Juggler
IT_Juggler

How about this? start MSTSC /console /f /v:%1 ::--------------------------- ::Usage ::--------------------------- ::Remote Desktop Connection :: ::MSTSC [] [/v:] [/console] [/f[ullscreen]] ::[/w: /h:] | /Edit"ConnectionFile" | /Migrate | /? :: :: -- specifies the name of an .rdp file for the ::connection. :: ::/v: -- specifies the terminal server to which you want :: to connect. :: ::/console -- connects to the console session of a server. :: ::/f -- Starts the client in full-screen mode. :: ::/w: -- specifies the width of the Remote Desktop screen. :: ::/h: -- Specifies the height of the Remote Desktop screen. :: ::/edit -- Opens the specified .rdp file for editing. :: ::/migrate -- migrates legacy connection files that were created with ::Client Connection Manager to new .rdp connection files. :: ::/? -- generates this Usage message. ::--------------------------- ::OK ::---------------------------

hmiller10
hmiller10

/console will take the RDP session into console mode just as if you were standing in front of the server.

Skimatik
Skimatik

I believe this is the aforementioned tool.Works in 2000 or 2000 server.

paulz1
paulz1

like: /console /edit /migrate /v::

morristl
morristl

I don't think the reverse scenario is true.

nenadandrejevic
nenadandrejevic

Also updated switch: /span - Matches the remote desktop width and height with the local virtual desktop

bulk
bulk

Hi all, Like many of us here, I use remote desktop connection often to maintain a large MS IPTV installation. There's another MS tool that's often overlooked, one that I prefer in many cases to remote desktop connection, and that's the Terminal Server MMC, otherwise known as tsmmc.msc. It's overlooked because it's not installed with XP. Dig out a server CD, (it's on all that I looked at), go to I386 and find the install file adminpak.msi. Double-click that and a bunch of 30 or so useful server management tools will be added to your XP start menu. One of these is "Terminal Services mmc". When you open this, you can add multiple remote servers to the mmc console. Once this is done you have a single management console you can use to access all your servers. The list of servers is presented in a list vertically on the left and you can click from server to server. It's the same software, just neatly packaged in an mmc console. Try it, you'll find it a useful alternative to the RDP included with XP. Richard

Jayanth
Jayanth

yesh right. /console is a pretty useful switch to use when the no. of remote connections have exceeded. mstsc /? will show all the available switches.

edglock21
edglock21

Microsoft says that the "/console" switch with MSTSC.EXE will not connect to a console session on a Win2k server, but will to a Server2k3 machine: http://support.microsoft.com/kb/311926 Jayanth - is your experience different, or is your reference to WinXP/Server 2k3 (not trying to start an arguement, just looking for info) ;-)

cokesrini
cokesrini

download this tool from microsoft website and install in 2000 server, it will work

morristl
morristl

Unless someone has hacked something, this does not work on Win2k. You can add the /console switch to your hearts content but it will be ignored on Win2k. You will just get a default session and not Video0.

edglock21
edglock21

...guess MS got it wrong again :D

limoges
limoges

Yes, this works fine on Win2K servers, use it every day.

drunkenjedi
drunkenjedi

This tool is part of the installation of Server 2000, Server 2003, and Windows XP.

andrew
andrew

Do you have the url to the tool please?

Editor's Picks