Open an elevated command prompt from the folder context menu
You might already know, the Windows Explorer has an extended context menu if you hold down “shift” while press the right mouse button. My personal favorite here is “Open command window here”. A prompt appears just in the folder you clicked. With lately increasing workload using the command-line this is a great help for me every day.
But as a developer often enough I require an elevated prompt. You can right-click a shortcut as select “Run As Administrator” to achieve this. But the prompt opened by above feature is never elevated. Also there is no command to elevate it. Sure, you could just run runas /user:Administrator@localhost cmd
– but that is not running under your current user. Still I have not looked into the Linux subsystem features prepared by the Win 10 anniversary update – but I found this cool registry entry on the web which adds a second context menu entry which gives you an elevated prompt (of course, after UAC confirmation).
https://gist.github.com/ZoolWay/1df8ce81ba21b55b35a44ba468f0f04d
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\Directory\shell\runas] @="Open elevated command window here" "Extended"="" "NoWorkingDirectory"="" "HasLUAShield"="" [HKEY_CLASSES_ROOT\Directory\shell\runas\command] @="cmd.exe /s /k pushd \"%V\"" [HKEY_CLASSES_ROOT\Directory\Background\shell\runas] @="Open elevated command window here" "Extended"="" "NoWorkingDirectory"="" "HasLUAShield"="" [HKEY_CLASSES_ROOT\Directory\Background\shell\runas\command] @="cmd.exe /s /k pushd \"%V\"" |
Credits belong here: http://www.sevenforums.com/general-discussion/75069-open-elevated-command-window-here.html#post657181
Have fun: