Home >System Tutorial >Windows Series >How to Open Command Prompt as Administrator from Context Menu

How to Open Command Prompt as Administrator from Context Menu

WBOY
WBOYOriginal
2024-08-01 19:25:111149browse

This article will show you how to add an Open Command Prompt here (Administrator) option to the right-click context menu for folders, Desktop and to This PC. So that you can open Command Prompt as Administrator from the context menu in Windows 10.

How to Add Open Command Window here as administrator to the context menu

To add Open command window here as administrator to the context menu for file system folders. Here's how:

Step 1: Open the Notepad in Windows 10.

Press Win+R keys to bring up Run dialog, input notepad and hit Enter key.

How to Open Command Prompt as Administrator from Context Menu

Step 2: Copy the below contents to Notepad.

To add the Open Command Window Here (Administrator) option to the context menu for file system folders, use the following REG file:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOTDirectoryshellrunas]
@="Open Command Window Here (Administrator)"

[HKEY_CLASSES_ROOTDirectoryshellrunascommand]
@="cmd.exe /s /k pushd "%V""

To add the entry to the context menu for Desktop, use the following REG file:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOTdirectoryBackgroundShellrunas]
@="Open Command Window Here (Administrator)"

[HKEY_CLASSES_ROOTdirectoryBackgroundShellrunascommand]
@="cmd.exe /s /k pushd "%V""

To add the entry to This PC (My Computer) context menu, use the following REG file:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOTCLSID{20D04FE0-3AEA-1069-A2D8-08002B30309D}shellrunas]
@="Open Command Window Here (Administrator)"

[HKEY_CLASSES_ROOTCLSID{20D04FE0-3AEA-1069-A2D8-08002B30309D}shellrunascommand]
@="cmd.exe"

Step 3: Save the cmd.reg file.

How to Open Command Prompt as Administrator from Context Menu

Step 4: Then right-click the REG file and choose Merge to automatically add the registry entries.

How to Open Command Prompt as Administrator from Context Menu

And then confirm the operation and you are done by clicking Yes.

How to Open Command Prompt as Administrator from Context Menu

This change will take effect immediately. Test it by right-clicking on a folder, drive or desktop.

How to Open Command Prompt as Administrator from Context Menu

The above is the detailed content of How to Open Command Prompt as Administrator from Context Menu. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn