You can launch your Command prompt window from any directory or folder you would like by using File Explorer, Context menu, Windows Terminal, and shortcuts.
The Command Prompt (cmd) is an extremely powerful command-line tool to perform a variety of tasks on the Windows computer. When you launch the Command Prompt in the Windows 11 PC, it is opened within the current directory of users (For example, C:UsersRand>). When you launch CMD in the administrator mode the default path is changed to the C:WindowsSystem32. However, there are times when you might need to start the command prompt within a particular directory or in the current directory location.
If you need to run a program in the specific location or folder and manually navigate to the folder using command (cd command) is a major hassle. Since it requires typing the entire path of the file (long name of the program and folder) at the Command Prompt. It is good news that Windows 11 allows you to open the Command Prompt directly from inside the folder file manager.
In this article we will look at the various ways to open the command prompt directly within any directory you wish.
Table of Contents
Start Command Prompt from any folder using File Explorer
One of the easiest and fastest ways to alter the directory within Command Prompt to any of your preferred folders is to use Windows File manager. Here’s how:
The first step is to open Windows Explorer and navigate to the location where you’d like to launch to the Command prompt. Once you’re inside the correct folder, simply click on the address bar on the top, and type into cmd and hit Enter.
This will bring up the Command prompt right inside the folder, with normal privileges as illustrated below.
Start Command Prompt in a Folder by Right-clicking Context menu
Another way to quickly open the Command prompt is to right-click the context menu of any folder. If you click right-click on the desktop or within the folder, you’ll be presented with the option to open the Command Prompt in Windows Terminal’ option.
When you start Windows Terminal in Windows 11 it will open using it’s PowerShell window. If you choose the “Open in Windows Terminal’ option from the Context menu, it will start PowerShell within that folder, as illustrated below.
If you switch the default profile of Windows Terminal from ‘Windows PowerShell” to Command Prompt then the Command Prompt will open inside the folder. This is how you can do it:
Then, you need to start Windows Terminal by right-clicking the Start button on the Taskbar and then selecting Windows Terminal.
When the Window Terminal is opened, press the down arrow at the top, and then select the ‘Settings’.
Under the tab ‘Startup select the default Profile drop-down menu, and then select the option ‘Command Prompt’.
Click on the Save button in the bottom-right corner . This will select Command Prompt as the default profile. When you launch Windows Terminal, it will begin with the Command Prompt as the prompt profile.
After you have changed the above setting, click on any folder or directory within the File Explorer and select ‘Open within Windows Terminal’.
It will now start the Command prompt right inside the folder.
Open CMD inside a Folder by using the context menu that appears when you right-click.
In earlier versions of Windows, there was an option on the context menu right-click called “Open command window here” or “Open PowerShell here” (on Windows 10), that has been replaced by the option ‘Open within Windows Terminal’. If you choose that option you will be able to start in the Command Prompt in the current folder’s where it is located.
Include ‘Open Command Window Here’ option in the Folder Context Menu by using the Registry Editor
You can restore the “Open command window here” option using the registry editor. Let us demonstrate how:
Then, you must start by opening Windows Registry by pressing Win+R then typing regedit and pressing Enter.
If the Registry Editor pops up you can navigate to the next path, either copy-paste the following path into the address bar, then press Enter:
After that, right-click the folder ‘cmd’ and choose ‘Permissions’ from the contextual menu.
The new dialogue box titled “Permissions for cmd” will appear. Within that dialog you can click the ‘Advanced’ button.
In the Advanced Security Settings for cmd window, click the ‘Change button next to the “TrustedInstaller” owner.
In the next window enter your username into the box that says ‘Enter the name of the object you wish to select’.
After that, click the “Check Names button to verify the user’s name, and then select “OK”.
Return to the Advanced Security Setting for cmd window, select the “Replace owner on subcontainers and objects’ option, then select ‘Apply’, and finally OK.
Once you’re done with this, click the ‘Administrators’ tab under Groups or user names, and then select the ‘Allow’ checkbox next to ‘Full Control’. After that, click “Apply” and then 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 adds the “Open Command Window here” choice to Windows 11 full Context menu. To open the Command Prompt on any folder you need to right-click on the folder, then select the option to show more options.
After that, select “Open Command Window Here” in the context menu of the previous.
You can now start the command prompt from any place.
Restore the Open command window in the Context menu by using Registry files
In case you’re experiencing a difficult to follow these steps, you could just create a registry file that will alter the registry entries necessary to bring back the ‘Open command window’ in the Context menu. This is how to do it:
Then start by opening Notepad (or any other text editor) and copy and paste the code below into the new text document.
Save this text file as an.rrf file. To do this, simply click the File menu and choose ‘Save’ or Ctrl+S.
Within the Save As dialog window, select “All files (*. *) in the Save as type drop-down. Then, include the extension ‘.reg’ after the file’s name. After that, click Save for saving the registry file. The file can be saved on your desktop or any other place.
Once you have saved the file, double-click it to launch the file.
If the UAC asks you to click ‘Yes’, then select Yes.
After that, click “Yes” again to open the Registry Editor warning.
This will add the new registry settings into the registry of your system.
You can now start the command prompt in any directory or folder by selecting the “Open command windows here” option.
CMD inside a directory:
You can also download previously registered registry files here by clicking the download link provided below.
After downloading your zip archive, unzip it and then run the “Add Command Prompt.reg’ document to include cmd into the contextual menu. To disable the “Open the command window here’ Command Window Here’ feature and return to your default settings, open the “Remove Command Prompt.reg file.
Include ‘Open command window here as administrator in the Context menu
The section above adds an option to the context menu that allows you to start the Command prompt using regular access. If you wish to launch a new Command prompt that is elevated (Administrator) within the directory or folder it is necessary to include the ‘Open command windows this way as an administrator’ choice in the Context menu. To accomplish this, you must create a new registry file.
Then, open a brand new text document using Notepad Then, cut and past the following code in the format:
After that, press Ctrl+S for saving the document. Within the Save As window, choose “All Files” in the Save as type drop-down. Then, select your file’s name. It can be whatever you like using the ‘.reg’ extension. (For example, Add CMD (Admin).reg).
Double-click the file you’ve created and then click ‘Yes’ when UAC is asked.
Select ‘Yes’ to Registry Editor warning to confirm the import operation.
Then, right-click any directory or folder, including Desktop and click “Show additional options” and you will be able to see the command prompt ‘Open in this case as an administrator’ appearing in the contextual menu.
Removing ‘Open command window here as administrator in the Context menu
If you do not want the ‘Open command windows this way as an administrator’ feature to be available, you can get rid of it by using a different registry file.
Create a new document within the Notepad and copy-paste this code
Windows Registry Editor Version 5.00 [-HKEY_CLASSES_ROOTDirectoryshellOpenCmdHereAsAdmin] [-HKEY_CLASSES_ROOTDirectoryBackgroundshellOpenCmdHereAsAdmin] [-HKEY_CLASSES_ROOTDriveshellOpenCmdHereAsAdmin] [-HKEY_CLASSES_ROOTLibraryFolderbackgroundshellOpenCmdHereAsAdmin] [-HKEY_CLASSES_ROOTLibraryFolderbackgroundshellOpenCmdHereAsAdmincommand]
Save the file as an ‘.reg file on your desktop. Then, you can open this file to disable the “Open command window here as administrator Option in the contextual menu.
You can also download the registry files above by clicking the link below.
Start Command Prompt from the Folder/Directory using a Shortcut
If you wish to launch Command Prompt in a specific directory instead of the default directory, you can make an cmd shortcut to that. This is how to do it:
Then, type in Command prompt or ‘cmd to find it in the Windows search engine, and then click the option to open the file in the left pane.
This will start your Windows System folder inside your user profile folder. In there, you’ll find the Command Prompt application shortcut. Right-click on the Command prompt shortcut and choose “Show additional options”.
Move your cursor to the ‘Send To’ option in the context menu, then select the option ‘Desktop (create shortcut) from the expanded context menu.
This will make the Command prompt shortcut for your Desktop.
If you click on the shortcut from within it, it’ll be opened within the current user’s profile. Here’s how to change the profile.
Then, right-click on the shortcut you’ve made and choose the ‘Properties option’ in the contextual menu.
In the Properties dialog box, go to the tab ‘Shortcut’ and then change the ‘Start in the following path’ to the address of the folder you would like the Command prompt to be opened to. For example, we want the CMD to open at ‘F:ConfidentialBlacked’. After that, click “Apply” and then ‘OK’ to save the modifications.
After you have completed the steps above After that, double-click the shortcut to start CMD at the location you want it to open.