Как получить путь к рабочему столу через cmd?
Как получить путь к рабочему столу через командную строку? Т.е. нужно открыть папку рабочего стола, не зная пути до рабочего стола. Может быть есть какие либо переменные окружения для этого?
Через запрос из реестра можно получить список всех папок
Для рабочего стола /v Desktop
![]()
Дизайн сайта / логотип © 2023 Stack Exchange Inc; пользовательские материалы лицензированы в соответствии с CC BY-SA . rev 2023.3.13.43308
Нажимая «Принять все файлы cookie» вы соглашаетесь, что Stack Exchange может хранить файлы cookie на вашем устройстве и раскрывать информацию в соответствии с нашей Политикой в отношении файлов cookie.
How do I navigate to a desktop in Windows CMD?

CMD is an acronym for Command Prompt officially known as Windows Command Processor. Geeks enjoy Command Prompt because it allows them to perform basic to complex administrative activities and fix various Windows issues.
You’ll first learn why you want to navigate, how to navigate and change directories in the command prompt. The instructor might not show you how to get to your desktop while you’re learning. As a result, I’ve arrived to assist you.
Why you want to navigate to desktop ?
- Automating tasks : Users can write scripts that can execute various action on files and folder in desktop.Automating these tasks on the PC using the command prompt saves time.
- Troubleshooting purpose:A user may need to use the command prompt to access to the desktop to run diagnostic or repair tools if their desktop or files are having issues.
- Accessing hidden files and folders on desktop:File explorer may not show secret desktop files. Users can view and manipulate hidden files and folders on the desktop using the command prompt.
Users can write scripts or batch files to execute actions on desktop files and folders. Automating these tasks on the PC using the command prompt saves time.
When utilizing the command prompt to get to the desktop, it isn’t always easy, and it can be difficult at times. I’ll show you how to browse to a desktop in Windows CMD in this tutorial. Let’s get started with the many ways to browse in Windows CMD without further ado.
Table of Contents
Method 1 : Using File Explorer (or Windows Explorer) and Command Prompt
We can easily navigate to the desktop with the help of File Explorer. File Explorer is a file management application that is included with the Windows Operating System that allows you to navigate files, folders, and drives present on your computer.
Note that Windows Explorer is not Internet Explorer.
1 Goto File Explorer (Press Windows + E )
Alternatively, Type File Explorer in the search bar and click on ‘File Explorer from the list
2 Navigate to the Desktop folder
3 Goto the top where it shows your location in the location bar (like the address bar in the browser), replace it with cmd, and press enter.
This will open a command prompt inside the current user’s desktop.
Method 2 : Using Drag & Drop and Command Prompt
In the command prompt, we can easily drag and drop folders and navigate to them directly.
1 Open Command Prompt and type cd
2 Open File Explorer and Find Desktop icon.
3 Just drag and drop the Desktop icon and paste it in the already opened command prompt.and press Enter
This will navigate inside the desktop.
Method 3 : Using Environment Variable and Command Prompt
An environment variable is simply a variable that stores a value. Some of the popular Environment variables are %userprofile%, %temp%, etc.
%userprofile% :%UserProfile% variable is a special system-wide environment variable holding user profile information. The path to your user profile folder is stored in the %userprofile% variable. It’s a collection of settings associated with a certain user.
This folder contains the user’s identification for operating systems, software, and websites. With the help of the %userprofile% environment variable, you can navigate to the desktop.
1 Open Command Prompt and
It contains %SystemDrive%\Users\
Windows is case insensitive, so you only need to be aware of what you type and not how you type it. You can type Cd, CD, or cd. Use capital letters, lowercase, or any combination of them.
Method 4 : Using Direct Method and command prompt
We know that the desktop path for a different version of the Windows operating system is a different path.
For Windows Vista, Windows 7, Windows 8, Windows 10, Windows 11 operating system, etc path is :
For Windows 2000, 2003, and XP OS, the path is:
For Windows 98, 95, and ME Operating System
Note: You can get your username by typing echo %username% in the command prompt.
- Press Windows + R and type cmd.exe and press Enter
- Then just type cd followed by the above command.
In my case, I am using Windows 11 and I will just type below:
where the rider is my username.
This will navigate to you directly inside the desktop path in the command prompt.
Method 5 : By Knowing Desktop Properties
By looking at desktop properties you will get the complete path of the desktop.
1 Right-click on ‘Desktop‘
2 Click on Properties
3 Navigate to the Location tab
4 Then you will get the desktop folder path of the current login user and copy it.
5 Then open the command prompt and just type:
where copiedtexthere is a text you have just copied
This will open your desktop path in the command prompt in the next line.
By pressing the Win + D keys, you can quickly navigate to the desktop. You can also get to the desktop by pressing the Win + M key while minimizing all open programs. However, when working with batch programming and CMD, you may want to navigate to the desktop, and there are several ways to do so which are listed above.
Overall, using the command prompt to navigate to the desktop gives users more freedom and control over their computer and its files, and can be particularly useful for advanced users or system admins.
Run command for remote desktop (RDP client)

Just open Run from start menu and type mstsc in the text box next to open and press enter.
This command mstsc can be used from command line too.
A system running Windows 7/Windows 10 allows only one remote desktop connection at a time, means only one remote user can work on it any time. A computer running Windows server edition can support remote sessions for multiple users at the same time.
Mstsc command
Every time we connect to the server it opens a new user session. To avoid this we can open a connection to the console. This allows us to login back to the same user session if we already have one. To do this we need to add /console switch to the mstsc command.
This command can be run from command prompt or from Run window.
Run command for opening remote desktop session in full screen mode
Add /f switch to the command.
Run command for specifying the remote computer name from the command itself
Use /v switch in this case.
Run command to specify remote desktop connection settings using a rdp file
A RDP file can be created using the ‘Save As‘ button in the General tab in mstsc(Remote desktop connection client) window.
These commands work on XP, Vista, Windows 7 and Server 2003/2008 operating systems.
Run command for Remote desktop manager
There is no Run command for opening remote desktop connection manager directly. It is usually installed in the path C:\Program Files\Remote Desktop Connection Manager\RDCman.exe . By specifying this complete path we can launch connection manager.
Relevant Posts:
Good information on the command line switches available with the mstsc command. thank you.
i would like to write command script to check whether the servers could RDP or not.
we have around 30 servers hence cant run mstsc /v:servername for each. Hence just would like to write cmd script to check all the servers. Could you please help me ?
You could do this by verifying the port is open through powershell.
test-netconnection -Port 3389
can you please assist me with the system to enable remote access desktop/working into the network user without being there physically,i have i.p address and computer name of the workstation and we are all in one network.
Possibly you only have Windows Home Edition, which doesn’t support Remote Connections.
Remote Desktop Assistance is a feature of Windows Pro Editions.
can user able to see the desktop in mstsc command
It is not mstsc/console anymore. Now it is mstsc/admin. You can also add it to a desktop shortcut by changing the Target to %windir%\system32\mstsc.exe -admin
“admin” is different than “console” actually. Admin allows you to boot another user. My bad.
Hello..is there any option to trigger MSTC on windows boot up, preferably with pre-specified destination server and credentials?
Also, if the user logs out of the terminal server, he should get logged out of the local desktop as well.
Удаленный рабочий стол (RDP). Командная строка
Меня всегда напрягал момент поиска утилиты удаленного рабочего стола в меню Пуск. Никогда не помнил, в каком именно разделе она находится и всегда тратил много времени на поиск.
Так я долго мучился,пока один добрый человек (спасибо тебе, Паша) не показал мне:
Win + R, mstsc

mstsc.exe — такое имя файла имеет утилита удаленного рабочего стола. Просто запомнить, легко вводить.
| Параметр | Описание |
|---|---|
| <имя файла> | Задает имя файла .rdp для подключения. |
| /v:<Server[:<Port>] | Задает имя удаленного компьютера, к которому необходимо подключиться и, опционально, номер порта подключения |
| /console | Коннект к сеансу физической консоли (сеанс 0). |
| /admin | Подключает к сеансу для администратирования. |
| /f | Запуск удаленного рабочего стола в полноэкранном режиме. |
| /w:<ширина> | Указывает ширину экрана удаленного рабочего стола. |
| /h:<высота> | Указывает высоту экрана удаленного рабочего стола. |
| /public | Запускает удаленный рабочий стол в общедоступном режиме. |
| /span | Сопоставление ширины и высоты удаленного рабочего стола с локальным виртуальным рабочим столом и развертывание на несколько мониторов при необходимости. |
| /multimon | Задает расположение мониторов сеанса служб удаленного рабочего стола в соответствии с текущей конфигурацией на стороне клиента. |
| /edit <имя файла> | Открывает указанный файл .rdp для редактирования. |
| /migrate | Переносит устаревшие файлы подключений, созданные диспетчером клиентских подключений, в новые файлы .rdp |
| /control | разрешает управление сеансом |
| /? | Показывает помощь по параметрам командной строки. |
Ключ помощи показывает окно с командами, соответствующими текущей версии программы.

Следует заметить, что ключ /console применяется для подключения к сеансу физической консоли на сервере (также известный как сеанс 0). Этот режим использовался в Windows Server 2003. В Windows Server 2008 или Windows Server 2008 R2,а также более новых версий, данный режим является устаревшим, т.к. сеанс 0 стал неинтерактивной сессией, зарезервированной для службы.
Поэтому RDC 6.1 не поддерживает ключ /console. Тем не менее, для обеспечения обратной совместимости, можно использовать параметр /admin для подключения к сеансу физической консоли на сервере под управлением Windows Server 2003. Подробнее можно почитать в данной статье: Изменения для удаленного администрирования в Windows Server 2008
Кроме того, ключ /admin обладает еще и следующими особенностями: