Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to open command prompt as administrator from address bar

Tags:

windows

cmd

I use address bar of File explorer to open command prompt in current directory(By typing cmd in address bar). It will open the command prompt as Administrator. I have used Windows 7 OS and I logged in as Domain Administrator.

Now I upgraded the OS to Windows 10. Now I am doing the same, But command prompt is not opened as Administrator.(For local Administrator account it was fine). Is there any way to get command prompt as Administrator(Opening from Address bar) ?

like image 734
Aravindharaj G Avatar asked Apr 29 '16 02:04

Aravindharaj G


2 Answers

Screenshot for achieving cmd in Admin mode

We can add this windows default shortcut for achieving cmd as Administrator in single click

like image 117
Aravindharaj G Avatar answered Sep 28 '22 18:09

Aravindharaj G


Unfortunately a recent Windows 10 Update has removed the Open command prompt mentioned by @Arvindharaj. However, if you feel comfortable editing the Windows Registry then this site that explains how to activate admin cmd right-click option might be a great option. It was for me.

Here are basic steps after launching regedit.exe:

  1. Go to this address: HKEY_CLASSES_ROOT\Directory\shell

  2. Under this folder create a new key and label it runas.

  3. Double-click the runas folder and check if there’s a “Default” key. Right-click it and choose “Modify.”

  4. Once you click “Modify,” the “Edit String” box shows up. Type Open Administrator Command Prompt Here in the Value data box.

  5. Next, in the same folder, create a new string value (right-click the runas folder and choose New and select String Value). Label it as NoWorkingDirectory.

  6. Under the HKEY_CLASSES_ROOT\Directory\shell\runas path, create another key and label it as command.

  7. Double click the folder and you’ll see the Default string value. Right click and choose “Modify.” Under the Value data, enter cmd.exe /k cd %1 and click OK.

FYI - I think this last step is wrong btw. The cmd prompt will launch as admin but in its default folder. So instead enter "cmd.exe /s /k pushd %V" and this should launch the admin prompt in the folder you right-clicked on.

like image 41
Alex G Avatar answered Sep 28 '22 18:09

Alex G