If you’re in IT, you probably have to use the command prompt quite often. You also probably have to navigate to specific folders and run certain commands or executables from that location. I don’t know about you, but having to type in CD foldername ten times is pretty annoying. Of course, there are shortcuts and you can actually just type one command to get to any folder you like, but who really wants to type out the full path, especially if its long.
Instead, it’s nice to be able to open a command prompt directly from Explorer starting in the folder of your choice. Now there are tons and tons of registry hacks and programs out there that help you add these extra options to your right-click context menu, but this isn’t actually necessary on all versions of Windows. If you are running Windows 7 or Windows 8, the option is already built-in, you just have to press a key before right clicking. I’ll explain further down.
If you are using Windows XP or Windows Vista, well, you should first read my article on why you should no longer be using Windows XP. If you’re on Vista, ask yourself why? Then upgrade to Windows 7 if you hate Windows 8. Otherwise, you have to use one of those registry hacks or annoying programs that add options to your context menu.
So in Windows 7 and 8, all you have to do is hold down the SHIFT key and then right-click on a folder:
You’ll see an option called Open command window here. This will get you a command prompt with the path to the folder set as the starting point.
But that’s not the only way to open a command prompt to a folder while in Explorer. Let’s say you are browsing around and you quickly want to open a command prompt for the folder you are currently viewing. Using the method above, you would have to click back to go to the parent folder, then hold down SHIFT, right-click and then open the command prompt.
If you don’t want to do that or navigate away from the folder, just click up in the address bar, delete everything and type in CMD. BAM! You get a command prompt set to that folder!
Make sure to press Enter after typing CMD. Pretty sweet, eh? If you are a Powershell user, instead of typing CMD, you just type powershell and you’ll get a Powershell window set to that folder.
The only issue here is how to open an elevated command prompt instead of just a normal prompt. Now that is unfortunately not as easy. In Windows 8, you can do this from Explorer by clicking on the File menu and selecting either Open command prompt or Open Windows PowerShell. There you will have the option for a regular or elevated command prompt.
This will still open the command prompt to the folder that you are currently in, so that’s a good thing. Unfortunately, this only exists on Windows 8. You can’t do this on Windows 7 or older versions.
Luckily, there is a simple trick you can perform in Windows 7 and earlier that will fix the issue. It’s not the safest thing to do, so I don’t recommend it unless you know what you are doing. So if you want Windows to open a command prompt as Administrator by DEFAULT, you can do this by turning off UAC. You can read my post on how to disable UAC in Windows 7.
You can also disable UAC in Windows 8, but I really don’t recommend that because then you can’t even open any Metro apps anymore. On Windows 7 and earlier, it just makes your system less secure.
So if you don’t want to disable UAC in Windows 7, but still want to open an administrative command prompt, you’ll have to go ahead and do the registry hack and add an option in the right-click context menu. You can check out this article here that shows you how.
Thanks for Lowell from HowToGeek for the tip on disabling UAC to open an administrative command prompt.
If you know of another way or trick for getting this done in Windows 7 and earlier, please let us know in the comments. Enjoy!