How to Connect to a Remote Computer Using Command Prompt

Techwalla may earn compensation through affiliate links in this story.
You can connect remotely to computer.
Image Credit: golubovy/iStock/GettyImages

If you're going to be away from your home computer, but you'll need to access it to perform a task or pull up a file, the remote desktop connection feature on Windows is the tool you need. There are some limitations. You need to have configured remote desktop on the PC previously, and it has to be switched on and not hibernating or sleeping.


With the right preparations, you can go directly to the computer you need to use from a distance. Although there are other approaches, you can easily connect to another computer using Command Prompt on the machine you're currently on.

Video of the Day

Set Up Remote Desktop Connection

Before you can connect to another PC via Command Prompt, you need to set up the feature on the computer you want to connect to. To do this on Windows 10, you need a Pro or business version of Windows (rather than Home). Click the Windows button to open the Start menu, then go to Settings by clicking the gear icon. Choose System, scroll down to Remote Desktop on the left, and then switch on Enable Remote Desktop.


Make a note of the name written under "How to connect to this PC." You may need it later.

You can also do this on older versions of Windows, such as Windows 8. Open the Control Panel and go to System and Security. Under System, click Allow Remote Access to bring up the System Properties dialogue. Go to the Remote tab and select the radio button beside Allow remote connections to this computer.

Specify Users Who Can Access

When you set up remote access, only users with admin privileges can access the machine remotely by default. However, if you want others to be able to access the computer, you can give them access. Click where it says Select users that can remotely access this PC from the User Accounts section at the bottom, and then click Add on the window that appears. In the new window, enter the username (or usernames) for the accounts you want to have access and then click OK.


Use CMD to Access Another Computer

After you set up remote access, you can use another computer's Command Prompt program to connect to your computer. Press the Windows key+r together to bring up Run, type "cmd" in the field, and press Enter. The command for the Remote Desktop connection app is "mstsc," which you use to launch the program. You are then prompted for the computer's name and your username.

You can use additional terms at the end of the command to access the computer directly through Command Prompt. Type "mstsc /console /v:computername" into Command Prompt, with the specific computer name you wrote down earlier in place of "computername." This entry takes you straight to the login screen for your remote computer. After you log on, you can use the remote machine as if it is the one you're sitting infront of.


You can also use the public IP address of your computer in place of the computer name to complete your connection. If you don't know the public IP, you can search "what's my IP" in Google, and it returns the answer immediately. You should set up a static (rather than dynamic) IP for your machine if you connect to it regularly; otherwise, the IP will change.

Additional Options for Command Prompt

You can also specify more when you open the remote desktop through Command Prompt. For example, add "/f" to the end of your command to open the desktop in full screen, or use "/w:" and "/h:" with values in place of "" and "" to open in a custom size. You can list all the available parameters using "/?" after your command.