At Winaero, I often write a number of articles which require you to open an elevated command prompt. A few examples are How to open elevated command prompt in Windows 10, Open elevated command prompt from non-elevated instance and A hidden way to open the command prompt in Windows 10. Today, I would like to share how you can open an elevated command prompt at the current folder you are browsing in Explorer. This saves your time.
As you might be knowing, by default, the elevated command prompt opens at the C:\Windows\System32 folder. This is not useful. You need to change the folder to another folder on your hard drive. It involves an additional console steps and commands. To speed up this process in Windows 7 and Windows Vista, I created ELE, a freeware app which you can use to open an elevated command prompt at the desired location.
But if you have the Ribbon enabled in File Explorer on Windows 10, Windows 8.1 or Windows 8, you can do this without any third party tool. Just follow these steps:
- Open the desired folder in File Explorer:
- On the Ribbon, click File -> Open Command Prompt -> Open command prompt as administrator:
- Confirm the UAC prompt and you are done!
Tip: How to add any ribbon command to the Quick Access toolbar of File Explorer.
Update: This option has been removed in Windows 10 Creators Update. See Windows 10 build 14986 replaces Command Prompt with PowerShell everywhere. To resolve the issue, please refer to the following articles:
- Open elevated command prompt from non-elevated instance
- How to open elevated command prompt in Windows 10
Also, see these articles:
- Add Command Prompt to Context Menu in Windows 10 Creators Update
- Add Command Prompt back to Win+X Menu in Windows 10 Creators Update
- Remove Open PowerShell window here from Context Menu in Windows 10
Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options:
5 thoughts on “Open command prompt elevated in the current folder”
When opening the cmd prompt as admin it always opens to C:\Windows\System32. If you do not open it as admin it opens to C:\Users\Username. I think you have things a bit backwards. I have never had it open to C:\Users\Username\Documents.
okay. But I often need to open it in c:\files\distr :)
Thanks. This will prove useful when tampering with stuff!!!
Good tip, I was doing it wrong, thanks.
This is how I was doing it before in order to open current directory in file explorer:
— Alt+D then Ctrl+C : that will copy current directory path
— Win+X then A : that will prompt UAC to open CMD with elevated privileges
— cd /d Ctrl+V [intro] : that will change the current directory to the one copied before
Not as fast as clicking, however, as I want to use keyboard most of the times, it seems that using hotkeys is perfectly supported.
Now I use:
— Alt+F then M finally B
You should also notice that running non elevated commands in the current directory, writing them in the Current Path edit box is totally acceptable, e.g.: Alt+D then write git clone …, or running an executable within that directory adding params for instance.
I didn’t notice that pressing ALT highlights the pinned CMD in the Quick Access Toolbar, giving them numbers, it is so much easier now, pressing Alt+3 in my case will launch the CMD with elevated privileges in the current directory, thanks, again.