Configure Windows Remote Desktop from the command line
Introduce
Windows Remote Desktop allows you to remotely control almost all Windows computers or Server servers. You can perform remote control from PC to PC, server to server, PC to server, or server to PC. The server component of RDP is built into Windows XP, Vista, or Windows 7 operating systems (however, you must authorize the remote workstation for that computer). On the desktop side, the connection to the PC is limited, but on the server side (such as Windows 2003 or 2008) you can allow multiple users to connect to the server using Terminal Services.
Even if you are using a desktop or server operating system, the client software is the same - Remote Desktop Connection or Remote Desktop Client. The executable file for the software is called mstsc.exe and has the path % systemroot% / system32 / mstsc.exe .
Here we will learn about what you can do with mstsc.exe .
Run Windows remote Desktop Connection from CLI
In using the Remote Desktop Client from the command prompt, you can use the basic command syntax for mstsc.exe as follows:
/ v: ServerName [: Port]} [/ console] [/ f] [/ w: Width / h: Height]
However, in Vista, please run mstsc /? , to get some more options:

Figure 1: Monitor help for remote desktop connection
On most computers we use, the use of remote desktop connection is not easy to identify in the Start Menu. So to simplify it, you should use Start -> Run , then type mstsc and press Enter.
Some reasons should run mstsc from CLI
Sure you will like Remote Desktop because from a laptop or desktop system, you can connect to any of your PCs or servers in the infrastructure. This method really makes a lot of convenience.
If regularly use the command line options. One thing you will often have to do is save a RDP File , which is a configuration file that has been saved for an RDP connection - or the server or PC you usually connect to. Obviously, there may be multiple RDP files for the same server or PC if you want to have multiple saved configuration files.
The '.rdp' files are simply text files that you can create or edit with notepad. Here is an example of the content of the file '.rdp':

Figure 2: The RDP file is opened in notepad
You can work inside notepad, but the most commonly used way to edit a .RDP file is to use the GUI Remote Desktop client because it provides more convenient Open, Save, and Save as options. for connection files:

Figure 3: Opening and saving RDP connection settings
You can also edit a file using the GUI but launch it from the command line using the / edit option for mstsc as follows:
mstsc / edit test.rdp
Some reasons for saving RDP files for later use:
- You can save connections to multiple servers and use the settings saved on your desktop or in a certain folder in the Start menu , see illustration below:
Figure 4: Create multiple RDP server connections in Start Manu
- In the case of multiple versions of the same connection - you can connect to a virtual desktop using VDI, you can use an icon to create a full-screen RDP connection or with 800x600 resolution.
- You may need an RDP file to connect to the server, another RDP file to connect to the server and run an application (all of which can be specified in the .rdp file).
Create Desktop Shortcut to run Remote Desktop
If you want to create a desktop shortcut to connect to a server. You can use the basic script of command line options or you can use those options and the .rdp connection file.
However, no matter how you use it, you need to enter the full command line in the desktop shortcut creation wizard.
Let's create a desktop shortcut:
- Connect to 'exchange' server
- Connect to the console of that server
- Create a 800x600 window
To do that, you need to run the command:
mstsc.exe / v: exchange / admin / w: 800 / h: 600
And to create a desktop shortcut, you need to enter the above command into create shortcut location , as illustrated below:

Figure 5: Creating a shortcut desktop with RDP
If these basic options are not enough, you can use the .rdp file .
To do this, you need to run mstsc.exe , then customize your connection as you like. Such as adding audio, adjusting bandwidth, setting applications to be run, adjusting performance, connecting internal devices and resources such as printers. When you have done all these tasks, simply click the Save as button on the General tab. After saving, name the file as fileserver . Make sure you know the directory with this RDP file saved. You should also check your connection here to make sure it works as expected.
Once saved, you can close the Remote Desktop Connection window, create your desktop shortcut. When entering the desktop shortcut location, you need to enter the connection file after msctsc.exe. Be sure to enter the full instructions for the .rdp file. The .rdp file needs to specify the path or the desktop shortcut and the .rdp file need to be in the same directory. Therefore, the syntax of the statement will be as follows:
Mstsc.exe c: usersdaviddocumentsexchange.rdp
If you run mstsc with a connection file, then you don't need to create a desktop shortcut. All you have to do now is save the RDP connection settings file and then run this file. The file itself, when run, will connect to mstsc.exe so it will automatically initiate a connection to the specified server within the connection file.
One final tip - if you want to change the default settings that mstsc uses to connect when you want to run the file without any adjustments, edit the Default.rdp file in the home directory.
Conclude
Windows Remote Desktop is a powerful analysis tool and it's hard to imagine what would happen without this tool. In addition to making an easy connection to the server using RDP GUI, one asserts that once you've used RDP a few times, you'll want to use it more. Using command line options with mstsc.exe and creating desktop shortcuts to connect to certain servers is the next step you need to take.
David Davis
You should read it
- Activate and configure Remote Desktop for Administration on Windows Server 2003
- Configuration steps for multiple Users to remotely connect to Windows Server 2016 using Remote Desktop
- Install Remote Desktop Web Connection on Windows XP
- Windows Server has an urgent patch to fix Remote Desktop errors
- How to enable Remote Desktop Management in Windows Server 2012
- Instructions for activating and using Remote Desktop on Windows 10 computers
- How to enable and use Remote Desktop on Windows 11
- 6 ways to disable Remote Desktop on Windows 11
May be interested
- How to Use Remote Desktop in Windows 7this wikihow teaches you how to enable and use remote desktop on two windows 7 computers. remote desktop is a built-in windows 7 feature which allows you to control one computer from another over the internet. in order to use remote...
- Manage the Event Log with the command linefor many of us, using the command line - command line to control and use some of the functions in the windows system will cause them to have headaches and problems. however, if you have to set up an automatic function system in windows and other server operating systems, the command line is an irreplaceable tool ...
- Instructions for using Remote Desktop on Windows 8a feature that appears from windows xp to higher versions is remote desktop, which allows users to connect to other computers on the network and work remotely. the article guides users on how to set up and use remote desktop metro application on windows 8.
- Use Remote Desktop to access remote computers via the Internetin this article, we will show you how to use the remote desktop feature in windows xp, vista, and windows 7, windows 8, and windows 10 to access and control remote computers via a network connection.
- Access Windows Remote Desktop via Internetthere are several solutions to access remote computers via internet like teamviewer, vnc. however, if you are running professional version of windows, remote desktop is installed in windows. before continuing, enable remote desktop on your computer and make sure you can access it from other computers on your local network.
- Install Remote Desktop Web Connection on Windows XPremote desktop web connection is an optional world wide web service component of the internet information services group that is integrated by default in windows xp pro, windows 2000, and windows server 2003 operating systems.
- 5 best command line emulation software for Windows 10currently, users can get a shell within windows 10, but many still prefer the more configurable command line emulator applications. so this article will introduce you to five of the best command line emulation software for windows 10.
- Configuration steps for multiple Users to remotely connect to Windows Server 2016 using Remote Desktopwith remote desktop connection, windows users can easily connect and work remotely. however, if you want to allow many people to connect at the same time to a windows server computer, how to do it?
- Leaks information about Microsoft's new Remote Desktop applicationmicrosoft is actively deploying the new remote desktop client, optimized for their windows virtual desktop ...
- Setting up and connecting Remote Desktop in Windows 7microsoft's remote desktop manager feature in windows 7 can easily allow users to connect from one computer to another in the same network, and share documents, documents ... in the article below, we will show you a few basic steps in the process of setting up and using this feature in windows 7.