Using the Remote Desktop Client from the Command Prompt

Remote Desktop Command in Run

Desktop / April 11, 2021

Overview

This article explains some of the parameters available when using MSTSC.exe to open a remote desktop connection. These commands can also be applied to create a remote desktop connection shortcut with custom set parameters. This article is a continuation of the Enabling Remote Desktop Protocol (RDP) and MSTSC article.

MSTSC Parameters

Several parameters are available.

  • /v:server: Specifies the remote computer to which you want to connect.
  • /console: Connects to the console session of the specified Windows 2000 Server.
  • /f: Starts Remote Desktop connection in full-screen mode.
  • /w:width /h:height : Specifies the dimensions 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.
  • /span: Span the length of the available area.
  • /admin: Log in to administer the server.

MSTSC Commonly Used Commands

For the average user, the commands that are probably the most relevant to you are /v and /f.

Note: If you are using the computer name to remote on to a machine, you must be on the same network like a VPN or be on the same internal network or you must have previously set up in a host file or have DNS configured correctly.

Let’s say the computer I’m trying to get on has a name of computer1 and an IP of 192.168.255.255.

Our syntax is mstsc {ConnectionFile|/v:server} [/console] [/f] [/w:width /h:height]

Full Screen

In the run command or shortcut I would type in mstsc /v:computer1 /f or

In the run command I would type in mstsc /v:192.168.255.255 /f

Assign a Height and Width

If I want to individually force my width and height (or assign both), I could use something like

mstsc /v:192.168.255.255 /w:1024 /h:768

mstsc /v:192.168.255.255 /w:1600

Span across multiple (2+) monitors

If you're like me, you like dual monitors. Only problem is when you RDP to another computer, you only use one of your monitors. Sometimes I like to have the extra space so I use the /span command.

For a shortcut or the run command: mstsc /v:192.168.255.255 /span or

mstsc /span

When using /span, your remote desktop window will get treated like its 1 giant monitor.

mstsc /admin

If you are a server administrator and you get something like:

  • “The terminal server has exceeded the maximum number of allowed connections”
  • A black screen after you RDP to a server (assuming your server hasn't crashed)

Source: www.interworks.com