The Command Prompt (cmd) is a powerful command-line utility for performing various tasks on a Windows computer. When you open a command prompt on your Windows 11 PC, it opens in the current user directory path (For instance, C:\Users\Rand>). And when you open CMD in the administrator mode, the default path is set to C:\Windows\System32. But, sometimes, you may need to open the command prompt window inside a specific directory or within the currently opened folder path.
If you have to run a program on a specific folder/location, manually navigating to that folder via commands (cd command) can be a real pain. Because requires you to type in the complete path of the file (long folder and program names) in the command prompt. Fortunately, Windows 11 allows you to directly open Command Prompt directly from inside a folder from within the file manager.
In this guide, we will see the different methods to launch a command prompt window directly in any directory you want.
Open Command Prompt inside any Folder using File Explorer
One of the simplest and quickest ways to change the directory in Command Prompt to any of your desired folders is through Windows File manager. Here’s how:
First, open Windows Explorer and navigate to the location from where you want to open the Command prompt. Once you’re in the right folder, click on the address bar at the top and simply type in cmd and press Enter.
This will open the Command prompt directly inside that folder with regular privileges as shown below.
Open Command Prompt In A Folder using Right-click Context menu
Another quickest way to open a Command prompt is through right-click context menu on any folder. When you right-click on the desktop or in a folder, you will see the ‘Open in Windows Terminal’ option.
By default, when you open Windows Terminal in Windows 11, it opens with the PowerShell window. So, if you select the ‘Open in Windows’ Terminal option from the Context menu, it starts PowerShell in that folder as shown below.
However, if you change the default profile in Windows Terminal from ‘Windows PowerShell’ to ‘Command Prompt’, the Command Prompt will open inside a folder. Here, you do this:
First, open Windows Terminal by right-clicking the ‘Start’ button from Taskbar and selecting Windows Terminal.
Once, the Window Terminal opens, click the down arrow button at the top and select ‘Settings’.
In the ‘Startup’ tab, click on the Default Profile drop-down menu and select ‘Command Prompt’.
Then, click on the ‘Save’ button at the bottom-right corner to set Command Prompt as the default profile. Now, whenever, you open Windows Terminal, it will start with Command prompt profile.
Once you changed the above setting, right-click on any directory/folder in the File Explorer and select ‘Open in Windows Terminal’.
Now, it will open the Command prompt directly inside that folder.
Open CMD in a Folder from the Right-click Context menu
In previous versions of Windows, there was an option in the right-click context menu called ‘Open command window here’ or ‘Open PowerShell here’ (on Windows 10), which is now replaced with ‘Open in Windows Terminal’. When you select that, it would open the Command Prompt in the current folder location.
Add ‘Open Command Window Here’ option to the Folder Context Menu using Registry Editor
You can still bring back the ‘Open command window here’ option by using registry Editor. Let us show you how:
First, open Windows Registry by pressing Win+R, typing regedit, and hitting Enter.
When the Registry Editor appears, navigate to the following path or copy and paste the below path in the address bar and hit Enter:
Then, right-click on the ‘cmd’ folder and select ‘Permissions’ from the context menu.
A new dialog box called ‘Permissions for cmd’ will open up. In that, click the ‘Advanced’ button.
On the Advanced Security Settings for cmd window, click ‘Change’ link next to the ‘TrustedInstaller’ owner.
On the next dialog window, type your username in the box under ‘Enter the object name to select’.
Then, click on the ‘Check Names’ button to validate that user name and click ‘OK’.
Back on the Advanced Security Setting for cmd window, check the ‘Replace owner on subcontainers and objects’ option, and click ‘Apply’ and then ‘OK’.
When you are done with that, select ‘Administrators’ under Group or user names and check the ‘Allow’ box next to ‘Full control’. Then, click ‘Apply’ and ‘OK’.
After configuring Permissions settings, right-click on the ‘HideBasedonVelocityID’ DWORD on the right pane and select ‘Rename’ (F2).
Then, rename the DWORD to ShowBasedonVelocityId and Enter.
This will add the ‘Open Command Window here’ option to the Windows 11 full Context menu. To open Command Prompt on any folder, right-click inside a folder, and select ‘Show more options’
Then, click ‘Open command window here’ from the old context menu.
Now you can open the command prompt on any location.
Restore Open command window here in Context menu using Registry files
If you’re having a hard time following all these steps, you can simply create a registry file to modify the necessary registries to restore the ‘Open command window’ here in the Context menu. Here’s how you do this:
First, open Notepad (or any text editor) and copy and paste the following code in a new text document.
Then, save this text document as a registry file. To do that, click the ‘File’ menu and select ‘Save’ or press Ctrl+S.
In the Save As dialog window, choose ‘All Files (*.*)’ from the Save as type drop-down and add the file extension ‘.reg’ at the end of the file name. Then, click ‘Save’ to save the file as a registry file. You can save the file on the desktop or in any other location.
After you save the file, just double-click on it to run the file.
If the UAC prompts, click ‘Yes’.
Then, click ‘Yes’ again to the Registry editor warning.
This will merge the new registry settings to your system registry.
Now, you can open the command prompt on any folder or directory using the ‘Open command windows here’ option.
CMD inside a directory:
You can also download the already created registry files here using the download link below.
Once you download the zip file, extract it, and run the ‘Add Command Prompt.reg’ file to add cmd to the context menu. To remove the ‘Open in Command window here’ option and restore the default state, run the ‘Remove Command Prompt.reg’ file.
Add ‘Open command window here as administrator’ to the Context menu
The above section adds an option in the context menu to only open the Command prompt with regular privileges. However, if you want to open a new elevated command prompt (Administrator) in a folder or directory, you have to add the ‘Open command window here as administrator’ option to the Context menu. To do this, you have to create a different registry file.
First, open a new text document in the Notepad, then copy and paste the following code as it is:
Then, press Ctrl+S to save the file. In the Save As window, select ‘All Files’ from the Save as type drop-down and enter the name of the file to anything you want with the ‘.reg’ extension. (For instance, Add CMD (Admin).reg).
Then, double click the file you created and click ‘Yes’ if UAC is prompted.
Click ‘Yes’ again to Registry Editor warning to confirm the import operation.
Now, right-click on any folder or directory including Desktop and then click ‘Show more options’ and you would see ‘Open command prompt here as administrator’ in the context menu.
Remove ‘Open command window here as administrator’ from the Context menu
If you don’t want the ‘Open command window here as administrator’ option anymore, you can easily remove it using another registry file.
Open a new text document in the Notepad, then copy-paste the following code:
Windows Registry Editor Version 5.00 [-HKEY_CLASSES_ROOT\Directory\shell\OpenCmdHereAsAdmin] [-HKEY_CLASSES_ROOT\Directory\Background\shell\OpenCmdHereAsAdmin] [-HKEY_CLASSES_ROOT\Drive\shell\OpenCmdHereAsAdmin] [-HKEY_CLASSES_ROOT\LibraryFolder\background\shell\OpenCmdHereAsAdmin] [-HKEY_CLASSES_ROOT\LibraryFolder\background\shell\OpenCmdHereAsAdmin\command]
Then, save the file as a ‘.reg’ file to your desktop. Now, you can run this file to remove the ‘Open command window here as administrator’ option from the context menu.
You can also download the above registry files using the below link.
Open Command Prompt in a Folder/Directory with a Shortcut
If you want to open Command Prompt in a specific directory instead of the default directory, you can create a cmd shortcut for that. Here’s how you do this:
First, search for ‘Command prompt’ or ‘cmd’ in the Windows search, then select ‘Open file location’ in the right pane.
This will open the Windows System folder inside your user profile folder. There, you will see Command Prompt application shortcut. Right-click the Command prompt shortcut and select ‘Show more options’.
Then, move your cursor to or click the ‘Send To’ menu on the full context menu, and select ‘Desktop (create shortcut)’ from the extended context menu.
This will create a Command prompt shortcut on your Desktop.
If you open this shortcut, it will open in the current user profile. Here’s how you can change that.
Now, right-click the shortcut you created and select the ‘Properties’ option from the context menu.
On the Properties dialog window, go to the ‘Shortcut’ tab and change the ‘Start in:’ path to the location of the folder that you want your Command prompt to open to. For example, we want the CMD to open at ‘F:\Confidential\Blacked’. Then, click ‘Apply’ and ‘OK’ to save the changes.
After completing the above steps, double-clicking the shortcut to open CMD to the location you wanted it to open.