When you open the command prompt by going to Run –> cmd, you will notice that by default, it opens in the user profile directory path. Sometimes, the user needs to open the command windows with the currently opened folder path. This article explains the exact scenario.
Command Prompt is the command-line which enables users to execute different programs and commands. Microsoft is slowly removing command prompt support from all its major Windows platforms. PowerShell is the alternative to Command Prompt which supports almost all the commands of DOS and much more. Some users still insist on using Command Prompt instead of PowerShell.
If the program you want to run in Command Prompt is not listed in the PATH variable, the Command Prompt will give you an error that it could not find the executable file. For this, we need to manually go to the folder where that particular program is located. One way of doing this is to type in the complete path of the file. Another way is to directly open the command prompt windows inside the folder. The second approach is more visual and easy to implement.
Pro Tip: If you are using Windows 10, just open the folder and go to File menu –> Open Windows PowerShell. You also have the option to open Windows PowerShell as Administrator.
Table of Contents
In this article, we will discuss different techniques by which we can open command windows in a folder, the most popular being “Open Command Windows Here” context menu item. Let’s start.
Add Open Command Window Here to the context menu using Registry Editor
- Click Windows + R then type regedit. This will open Windows Registry editor.
- Registry editor window will open. After that go to HKEY_CLASSES_ROOT. Further go into Directory\shell\cmd
- and right click Permissions. The following window will appear.
- Then click on the Advanced option.
- After that, click on change at the top of the window
- Type your username in “Enter the object name to select” and then click on the check name to validate that name.
- Press Apply and then OK. When you are done with those Administrative modes in Group or user names of permissions for cmd window and tick Allow on Full control. Click Apply and then OK
- Once you are done with it, click on HideBasedonVelocityID and rename it ShowBasedonVelocityId
- Now when you click the Shift key and right click you will see the option “Open Command Window here“
This will permanently add “Open Command Window here” to the Windows Context menu. After editing the Registry, you will be able to open the command prompt by right clicking inside any folder and selecting “Open Command Window Here”.
Add Open Command Window Here using the REG file
This is basically the same method listed above. For your ease, we have created a REG file for all the actions mentioned above. You just have to download and run the REG file. It will automatically add the desired values inside the Windows Registry.
Add Open Command Window Here to Context Menu.reg (304 bytes, 20,545 hits)
If the value does not come after running this file, please try restarting Windows Explorer or the computer.
Open Command Prompt In A Folder Using Keyboard Shortcut?
If you are in a hurry then this is the easiest method of opening Command Prompt inside the folder. Just follow the steps below:
- Go to the required folder.
- The press Shift + right click mouse button anywhere in the folder window.
- Select the “Open command window here” option from the context menu.
Using CMD command in File Explorer to open Command Prompt Window
You can open a command prompt in any of your desired folder by using the file explorer location bar.
- Go to your desired folder and click on the location bar of Windows Explorer.
- Then type cmd and press Enter key.
- The command prompt will be opened in the folder.
One drawback of this technique is that it will open the command prompt in the regular user privilege mode and not in the administrative mode. To open it in administrative mode:
Select Windows + R and type cmd.
Click Ctrl+Shift+Enter instead of just hitting enter to open the Command Prompt in administrative mode.
You can also open PowerShell window using the same technique. Just go to the folder and then type powershell in the File Explorer address bar. This will open PowerShell in the same folder location or path.
Add “Open Command Window Here” with Administrative privileges in the context menu
In order to “open Command Window here ” with administrative privileges you can download the following file.
Open Command Window Here (Administrator) to context menu.reg (215 bytes, 12,445 hits)
This will add a context menu option for the admin command prompt.
How to get back Command Prompt in Win+X menu?
In order to change the Windows Powershell options with Command Prompt go to Settings –> Personalization –> Taskbar. After that turn off the option of “Replace Command Prompt with Windows Powershell Option in the menu when i right click the start button or press Windows key +X”.
The Command Prompt still remains an important part of Windows Operating System and using the methods discussed above, you will be able to make productive use of your time by using shortcuts. What is your favorite method of running command prompt without typing in the folder paths?
Еще в ранних версиях Windows 10 можно было, зажав клавишу [Shift], кликать правой кнопкой по папке в проводнике и вызывать командную строку, но более поздние версии Windows 10 позволяют открывать только PowerShell. Чтобы вернуть окно команд в контекстное меню, нужно изменить реестр.
Нажмите [Win] + [R] и введите «regedit» без кавычек. Откройте путь «HKEY_CLASSES_ROOT\Directory\shell\cmd», правой кнопкой щелкните «cmd» и выберите «Разрешения». В следующем окне щелкните «Администраторы» и установите внизу в поле «Полный доступ» флажок «Разрешить». Щелкните «Применить» и затем «OK».
Если выскочило уведомление, что не удалось сохранить изменения из-за отказа в доступе, необходимо использовать немного другой путь. Снова нажмите правой кнопкой на «cmd» и выберите «Разрешения».
В открывшемся окне выберите «Дополнительно» и далее «Изменить» вверху. Введите свое точное имя пользователя в поле для ввода и нажмите «Проверить имена».
Если имя подтверждено, то Windows скорректирует ввод. Нажмите «OK» и вернитесь в окно, где можно разрешить полный доступ. Но теперь выберите строку «Пользователи» и активируйте полный доступ, нажав «Применить» и подтвердив «OK». Подсказка: точное имя пользователя вы найдете в папке «C:\Пользователи».
Вернитесь в редактор реестра. В правом поле есть параметр «HideBasedOnVelocityId». Щелкните по нему правой кнопкой, выберите «Переименовать» и добавьте в начало имени, например, дефис.
Закройте редактор реестра. Теперь в контекстном меню любой папки при зажатой клавише [Shift] снова появится строка «Открыть окно команд».
Читайте также:
- Как Windows 10 взломать реестр и удалить OneDrive из Проводника
- Как создать резервную копию реестра Windows
Фото: компании-производители
Способ 1: Указание пути
Для начала рассмотрим метод, который подразумевает не запуск консоли в папке, а переход в нее непосредственно через интерфейс консоли.
- Откройте в «Проводнике» то расположение, в котором требуется запустить «Командную строку», выделите и скопируйте указанный в верхней строке адрес. Для этого можно воспользоваться клавишами «Ctrl+C» или соответствующим пунктом контекстного меню.
Читайте также: Как открыть «Проводник» в Виндовс 10
- Любым удобным способом запустите консоль, например, воспользовавшись поиском по системе (запрос —
cmd
).Читайте также: Как вызвать поиск и открыть «Командную строку» в Windows 10
- Введите команду следующего вида и нажмите «Enter».
cd путь к папке, в которой требуется открыть консоль
(в нашем примере это
cd C:\Lumpics
)
На этом поставленная перед нами задача решена – «Командная строка» открыта в папке, дальнейшие команды будут выполняться в указанном расположении.
Обратите внимание! Если действия, которые вы планируете осуществить, требуют административных полномочий, запускать консоль нужно от имени пользователя, обладающего соответствующими правами. О том, как это сделать, рассказывается в отдельной статье на нашем сайте.
Подробнее: Как запустить «Командную строку» от имени Администратора в Виндовс 10
Способ 2: Контекстное меню и PowerShell
В предшествующих «десятке» версиях Windows открыть консоль в папке можно было через контекстное меню, но теперь в данном пункте фигурирует PowerShell. Из этой системной оснастки тоже крайне просто перейти к той, что интересует нас.
- Откройте папку, в которой требуется запустить «Командную строку», кликните правой кнопкой мышки (ПКМ) по пустому месту и выберите пункт «Открыть окно PowerShell здесь».
- Введите запрос
cmd
и нажмите «Enter». - Несмотря на то что интерфейс не изменится, необходимое вам расположение будет открыто именно в консоли, с поддержкой характерного для нее синтаксиса команд.
Читайте также: Команды для «Командной строки» в Виндовс 10
Способ 3: Меню «Проводника»
Данный метод по своей сути является альтернативой предыдущему и отличается лишь первым шагом.
- Перейдя в нужную директорию через «Проводник», вызовите меню «Файл», выберите в нем пункт «Запустить Windows PowerShell», а затем аналогичный ему в появившейся дополнительной вкладке.
- Введите команду
cmd
и воспользуйтесь клавишей «Enter» для ее выполнения. - Как и в предыдущем случае, «Командная строка» будет открыта в указанном расположении, хотя и сохранит интерфейс «PowerShell».
Наша группа в TelegramПолезные советы и помощь
Shift+Right-click in the folder to see the option to open CMD
Published on July 29, 2024
What to Know
- From the folder you want to open in Command Prompt, hold the Shift key, then right-click an empty area.
- From there, select Open in Terminal (W11) or Open PowerShell window here.
- Alternatively, change the folder path (at the top of File Explorer) to cmd. Press Enter to open CMD in that folder.
This article teaches you how to open Command Prompt in a way that lets you start working from a specific folder immediately. Here’s how to start CMD from a folder in Windows 11 (it’s very similar in older versions).
How to Open CMD in a Folder
It’s easy to start Command Prompt the normal way, but if you know which folder you want to run commands in, you’ll save yourself a step or two if you open Command Prompt in the folder from the start. Below are two methods.
Change the Folder Path
Follow these steps for the fastest way to open Command Prompt in a folder. All you have to do is type cmd in the right place.
-
Open File Explorer to the folder you plan to work in. For example, if it’s your Downloads folder, you’d navigate here:
C:\Users\[your username]\Downloads
-
Erase the folder path at the top of the window. Pressing Alt+d is a quick way to highlight the whole path.
-
Replace the path with cmd.
-
Press Enter. This will open Command Prompt directly to that folder.
Use a Keyboard Shortcut
Here’s how it works with a simple keyboard+mouse shortcut:
-
Go to the folder you want to access from Command Prompt.
-
While holding the Shift key, right-click once in an empty area of the folder (don’t select any files or subfolders).
-
Select Open in Terminal if you’re on Windows 11. Older versions of Windows have a similar option called Open PowerShell window here.
Terminal is the command line tool used in Windows 11. Follow that link to learn how to access Command Prompt and other tools from Terminal.
The Command for Changing Folders in Command Prompt
The steps listed above are simple ways to open CMD to a certain folder without dealing with commands. But, did you know there is a command meant for this very purpose?
It’s called the change directory command and it’s invoked by typing cd. It’s how you open a different folder from inside Command Prompt, which is useful if you don’t want to start a brand-new instance of Command Prompt just to change the folder you’re in.
How to Clear the Windows Command Prompt Screen
FAQ
-
It’s a command-line interpreter program that’s available on all Windows PCs. It’s often used to perform more advanced administrative functions or to troubleshoot an issue. The commands you can use depend on which version of Windows you own.
-
Type cls and press Enter. This clears all the previous commands you entered.
-
Yes, but you need to enable it first in some instances. Open Command Prompt, right-click on the top bar, and select Properties. Under Edit Options, select the checkbox next to Use Ctrl+Shift+C/V as Copy/Paste.
-
Thanks for letting us know!
Get the Latest Tech News Delivered Every Day
Subscribe
Download Windows Speedup Tool to fix errors and make PC run faster
The Command Prompt is a feature of Windows that lets you execute MS-DOS and other computer commands and perform tasks on your computer without using the Windows graphical interface. There are various ways how you can launch Command Prompt windows.
In this post, we will see two very simple ways to open a command prompt window in any folder or on the desktop, without having to navigate the menu. The first is using the context menu.
1] Hold down the Shift key and use the context menu
UPDATE: Windows has now replaced Open command window here with Open PowerShell window here. But with a registry tweak, you can restore Open command window here item to Windows folder context menu.
To open a command prompt window in any folder, simply hold down the Shift key and right-click on the desktop. In the context menu, you will see the option to Open command window here. Clicking on it will open a CMD window.
You can also do the same inside any folder. The prompt takes the path of the folder from where it is opened.
In Windows 11 you have to press the Shift key, then right-click inside the folder and then, keeping the Shift key pressed, click on More options.
You will see the extra entries there.
2] Type CMD in the address bar
There is another trick to do the same thing. navigate to the folder and then simply type CMD in the address bar and hit Enter to open the command prompt window there.
You will see the CMD taking the path of this folder.
Related read: How to change Directory in Command Prompt.
Speaking of the command prompt, there are several Command Prompt tricks you may not know, including how to open an elevated command prompt using a CMD. Check them out!
Anand Khanse is the Admin of TheWindowsClub.com, a 10-year Microsoft MVP (2006-16) & a Windows Insider MVP (2016-2022). Please read the entire post & the comments first, create a System Restore Point before making any changes to your system & be careful about any 3rd-party offers while installing freeware.