Friday, October 5, 2018

Open Command Window Here as Administrator with Hotkey



 

   To add a context menu item "Open Command Window Here as Administrator" you need to create AddMenuItem.reg file and paste the following code there:

Windows Registry Editor Version 5.00

[-HKEY_CLASSES_ROOT\Directory\shell\runas]
[HKEY_CLASSES_ROOT\Directory\shell\runas]
@="Open Command Window Here as &Administrator"
"HasLUAShield"=""
[HKEY_CLASSES_ROOT\Directory\shell\runas\command]
@="cmd.exe /s /k pushd \"%V\""

[-HKEY_CLASSES_ROOT\Directory\Background\shell\runas]
[HKEY_CLASSES_ROOT\Directory\Background\shell\runas]
@="Open Command Window Here as &Administrator"
"HasLUAShield"=""
[HKEY_CLASSES_ROOT\Directory\Background\shell\runas\command]
@="cmd.exe /s /k pushd \"%V\""

[-HKEY_CLASSES_ROOT\Drive\shell\runas]
[HKEY_CLASSES_ROOT\Drive\shell\runas]
@="Open Command Window Here as &Administrator"
"HasLUAShield"=""
[HKEY_CLASSES_ROOT\Drive\shell\runas\command]
@="cmd.exe /s /k pushd \"%V\""

[-HKEY_CLASSES_ROOT\*\shell\runas]
[HKEY_CLASSES_ROOT\*\shell\runas]
@="Open Command Window Here as &Administrator"
"HasLUAShield"=""
[HKEY_CLASSES_ROOT\*\shell\runas\command]
@="cmd.exe /s /k pushd \"%V\\..\" && echo \"%V\""

[-HKEY_CLASSES_ROOT\batfile\shell\runas]
[HKEY_CLASSES_ROOT\batfile\shell\runas]
@="Open Command Window Here as &Administrator"
"HasLUAShield"=""
[HKEY_CLASSES_ROOT\batfile\shell\runas\command]
@="cmd.exe /s /k pushd \"%V\\..\" && echo \"%V\""

[-HKEY_CLASSES_ROOT\cmdfile\shell\runas]
[HKEY_CLASSES_ROOT\cmdfile\shell\runas]
@="Open Command Window Here as &Administrator"
"HasLUAShield"=""
[HKEY_CLASSES_ROOT\cmdfile\shell\runas\command]
@="cmd.exe /s /k pushd \"%V\\..\" && echo \"%V\""



   Now just execute the file. The changes above will be added into the Windows Registry. The new context menu item appears on Drives, Folders, Files and any place in Windows Explorer.
   Note the ampersand before "Administrator" - it allows to use a hotkey instead of using mouse.
   So to open a command window with Administrator permissions everywhere in Windows Explorer, just use       SHIFT + F10 + A 




No comments:

Post a Comment