In Windows Vista, Microsoft added UAC (User Account Control), which prevents privilege escalation for running apps and requires explicit user confirmation in case the application needs to perform an elevated task. Some console commands also require elevation. So, if you accidentally type such a command in the regular command prompt window, it will fail. You need to open yet another, elevated command prompt instance. Most people don't know how to open an administrator command prompt and it is not easy for them.
You can open an elevated command window using one of the methods mentioned here: Do you know all these ways to open an elevated command prompt in Windows?. The problem is even after opening it, you often need to change the current path to the required directory. This is because, by default, Windows opens the elevated command prompt at C:\Windows\System32. Command Prompt does not provide any built-in feature to open its elevated instance at the same path.
To solve this issue, you can use ELE.exe - a tiny console application I coded to open a new console window at the current directory from the existing command prompt window.
The usage of ELE is very simple.
Just type ele at a non-elevated command prompt and press Enter. It opens a new console window as administrator in the current directory:
ele /x - opens a new console window in the current directory and closes the original console window. If ELE is started from a file manager, it automatically opens a new elevated console at the current path.
Put ele.exe in any folder which is included in your system %PATH% environment variable, e.g. C:\Windows. That will make it accessible from any folder and you will not need to type the full path to ele.exe every time you want to elevate the command prompt.
You can download ELE here:
This is not the only way to can use ELE. It can be integrated into your favorite file manager, like File Explorer, FAR Manager or Total Commander. Here are a few examples below.
Open an elevated command prompt from File Explorer
If you copy ELE.exe to any directory in your system path such as C:\Windows, then you can simply press Alt+D while you are working in any folder to take the focus to the address bar, and type there: ele and press Enter. An elevated command prompt will open at the path you are in. This is a fast method using the keyboard.
It is also possible to integrate ELE with the File Explorer app. Once this is done, you will be able to open an elevated command prompt from the context menu directly.
To get it working, just merge the following Registry tweak:
Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\Directory\Background\shell\ele\command] @="ele.exe" [HKEY_CLASSES_ROOT\LibraryFolder\background\shell] [HKEY_CLASSES_ROOT\LibraryFolder\background\shell\ele] [HKEY_CLASSES_ROOT\LibraryFolder\background\shell\ele\command] @="ele.exe" [HKEY_CLASSES_ROOT\Directory\shell\ele\command] @="cmd /c cd /d \"%1\" & ele /x"
The result will be as follows:
Open an elevated command prompt from Total Commander
Just drag and drop ele onto the toolbar in Total Commander and remove the "Start path" value for the button you just created as shown below:
That is required so ELE opens an elevated command prompt window using the directory opened in the active panel of Total Commander.
Open an elevated command prompt from FAR
FAR Manager, the open source console file manager which was very popular some time ago, has a nice feature called "User Menu". It is a special menu which appears when you press the F2 key. The user can add his own commands to that menu, so ELE can be added there.
Press F2, then press INS. Type ele.exe in the command box and you are done:
ele application.exe [arguments]
For example, the following command will open Notepad elevated with the file specified after it:
ele notepad.exe d:\text1.txt
That's it. If you found anything to say about ELE, report a bug or make a suggestion, you are welcome to comment.
Support us
Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options:
Is there a download link anywhere?
Ah, sorry , forgot to add.
Will add it now.
Thank you!
Thank you for poiting.
Added.
Hi, I think you should add the option to the article, that with standard Windows Explorer there is this option too. If you select file and there open command prompt and click right on open command prompt as administrator you can add an icon to the quick access toolbar. And voila whenever you are in any folder it will open an elevated command prompt there if ypo click on the icon in the access toolbar…
By the way, with this procedure you can add any (!) option from the file menu of Explorer to the toolbar. I think this is an good option without any extra program.
Well, it is available only if you are running Windows 8 and above.
Windows 7 users are out of luck.
But how does Microsoft do it in Windows 8/8.1/10’s File Explorer? It’d be nice to know and would allow Sergey to publish an article for people who don’t want a third-party app (unless he has covered this already).
Microsoft implemented a special command in 8,8.1 and 10. You can find it in File – Open elevated command prompt.
I know that but what is the command exactly? We could find out so that we’re able to use it manually without File Explorer.
Can it be found in the Registry?
It is not possible to use that command outside the File Explorer.
It is harcoded in the Explorer shell. It has no binary you could execute separately.
It can be done without 3rd-party tools:
@echo off
setlocal ENABLEEXTENSIONS DISABLEDELAYEDEXPANSION
if /I “%~1″==”/Install” goto s_i
if /I “%~1″==”/UnInstall” goto s_u
goto m
:s_i
REG ADD HKCU\Software\Classes\.elecmd\shell\runas\command /ve /t REG_EXPAND_SZ /d “CMD /K cd /D %%*”
goto end
:s_u
REG DELETE HKCU\Software\Classes\.elecmd
goto end
:m
set n=%random%%random%.elecmd
echo. > “%temp%\%n%”
start “” “%temp%\%n%” “%CD%”
ping localhost > nul
del “%temp%\%n%”
:end
Save as ELE.cmd in the Windows directory and run “ELE /install” and you are good to go…