Connecting to other computers using RDC through the command line allows you to control different settings and preferences of the connection. Windows allows a user to use certain switches to predefine the settings before the connection is made. For example, you can define the name or IP address of the remote computer, or adjust the RDC window size even before running the tool. Learn how to enable RDC in Windows 11. Let us help you become aware of the switch options and how you can use them to configure your RDC connections.
MSTSC commands and switches
The conventional way to open the RDC in Windows is by searching for “Remote Desktop Connection” or “RDC” in Run and open the tool. This then opens the RDC tool where you can enter the name of IP address with port number (optional) of the remote computer that you want to connect to. Most of you would already be aware of this method. This section covers the possible commands and switches that you can use with RDC via the command line. We shall start with the most basic ones and then continue.
Launch RDC from Run
The very basic command to run Remote Desktop Connection from the command line is via Run. Simply type in the following in Run and hit Enter. Running this will open the RDC with a blank text field. However, with the addition of a few switches, you can change the settings and preferences of the RDC connection. Let us continue forward with a few examples.
Use RDC to connect via console
Although RDC fully supports GUI, you can also connect to remote machines through a console. This will help in case you wish to continue the session that you got disconnected from earlier. In contrast, a regular GUI-based RDC session creates a new session each time you connect to the same machine. Use the following command to connect to a remote computer via console:
Launch RDC with IP address
You can also launch RDC along with the IP address of the machine to connect it with. If the port on the machine is changed from the default value, you can also add the port number. Use the following commands to do so: Replace IPAddress with the complete IP address of the remote computer that you want to connect with, and PortNumber with the port number if changed from its default value.
Launch RDC with computer name
You can also connect to the remote computer by its unique computer name. The switch used for this is the same one used with the IP address and port number in the steps above. Replace ComputerName with the unique name of the remote device that you can find in its settings or properties.
Launch RDC in full-screen mode
You can also launch the RDC connection in full-screen mode. Here is how: These switches can be combined into a single command to execute an RDC connection to your preferences. Here is an example:
MSTSC commands and switches
There are more commands and switches you can use with mstsc command-line to adjust your settings for the connection beforehand. Here is the complete list: These switches can have the following syntax in either Run or the Command Prompt: The parameters in the alligator brackets (< and >) are variables that you can adjust according to your preferences.
Troubleshoot RDC via command line
You can also troubleshoot Remote Desktop services through the command line. For example, if you are unable to connect to a device using the GUI RDC but have access via console, you can check whether there are any configurations to be made that will connect you via GUI successfully.
Check if RDP is enabled from Command prompt
Learn how to enable RDP remotely. You can run the following command to check the status of your device if RDP is enabled or disabled: If the results come back as “Listening,” it means that RDP is enabled.
Check if RDP is enabled from PowerShell
Another method to check whether RDP is enabled is through Windows PowerShell. You can run the following commands in PowerShell and it will tell you whether the service is available or not. If the script returns “RDP is enabled,” it means that it is.