A command prompt is an entry point for typing computer commands in the Command Prompt window. By typing commands at the command prompt, you can perform tasks on your computer without using the Windows graphical interface.
This tutorial will show you how to add or remove a Open command window here as administrator context menu for all users in Windows 11.
This context menu will open an elevated command prompt using the same working directory that you right clicked on.
You must be signed in as an administrator to add, remove, and use the “Open command window here as administrator” context menu.
The “Open command window here as administrator” context menu will be available when you right click or shift + right click on a folder, drive, or mapped network drive and when you right click or shift + right click on the background of a folder, drive, mapped network drive, library background, or desktop.
1 – Create a new reg file like openterminal.reg and paste the content
Windows Registry Editor Version 5.00
; Created by: Sonik Blast
; Created on: November 10, 2022
[HKEY_CLASSES_ROOT\Directory\shell\OpenCmdHereAsAdmin]
@="Open command window here as administrator"
"Extended"=-
"Icon"="imageres.dll,-5324"
[HKEY_CLASSES_ROOT\Directory\shell\OpenCmdHereAsAdmin\command]
@="cmd /c echo|set/p=\"%L\"|powershell -NoP -W 1 -NonI -NoL \"SaPs 'cmd' -Args '/c \"\"\"cd /d',$([char]34+$Input+[char]34),'^&^& start /b cmd.exe\"\"\"' -Verb RunAs\""
[HKEY_CLASSES_ROOT\Directory\Background\shell\OpenCmdHereAsAdmin]
@="Open command window here as administrator"
"Extended"=-
"Icon"="imageres.dll,-5324"
[HKEY_CLASSES_ROOT\Directory\Background\shell\OpenCmdHereAsAdmin\command]
@="cmd /c echo|set/p=\"%V\"|powershell -NoP -W 1 -NonI -NoL \"SaPs 'cmd' -Args '/c \"\"\"cd /d',$([char]34+$Input+[char]34),'^&^& start /b cmd.exe\"\"\"' -Verb RunAs\""
[HKEY_CLASSES_ROOT\Drive\shell\OpenCmdHereAsAdmin]
@="Open command window here as administrator"
"Extended"=-
"Icon"="imageres.dll,-5324"
[HKEY_CLASSES_ROOT\Drive\shell\OpenCmdHereAsAdmin\command]
@="cmd /c echo|set/p=\"%L\"|powershell -NoP -W 1 -NonI -NoL \"SaPs 'cmd' -Args '/c \"\"\"cd /d',$([char]34+$Input+[char]34),'^&^& start /b cmd.exe\"\"\"' -Verb RunAs\""
[-HKEY_CLASSES_ROOT\LibraryFolder\background\shell\OpenCmdHereAsAdmin]
; To allow mapped drives to be available in command prompt
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System]
"EnableLinkedConnections"=dword:00000001
Code language: JavaScript (javascript)
Now run the reg file, you will se this
