18

I don't want to install PowerToys, I'd rather a simpler solution for this specific problem.

I've tried Ctrl+Shift+Right-Click.

I've tried adding a registry script, but I get the following error:

Cannot import D:\Admin\Reg\Open command window here (Administrator)\Open command window here (Administrator).reg: The specified file is not a registry script. You can only import binary registry files from within the registry editor.

Any suggestions?

Edit:

Forgot to mention: I've tried the import facility in regedit to no avail

Oliver Salzburg
  • 89,072
  • 65
  • 269
  • 311
Josh Comley
  • 4,122

8 Answers8

25

This is one of my favorites, It also takes a bit of work.

1.- Create a file.txt

Windows Registry Editor Version 5.00

[-HKEY_CLASSES_ROOT\Directory\shell\runas]

[HKEY_CLASSES_ROOT\Directory\shell\runas]
@="ElevatedCMD"
"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]
@="ElevatedCMD"
"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]
@="ElevatedCMD"
"HasLUAShield"=""

[HKEY_CLASSES_ROOT\Drive\shell\runas\command]
@="cmd.exe /s /k pushd \"%V\""

[HKEY_CLASSES_ROOT\LibraryFolder\background\shell]
@="none"

[HKEY_CLASSES_ROOT\LibraryFolder\background\shell\runas]
@="ElevatedCMD"
"HasLUAShield"=""

[HKEY_CLASSES_ROOT\LibraryFolder\background\shell\runas\command]
@="cmd.exe /s /k pushd \"%V\""

2.- Rename the file.txt to file.reg

3.- Click in file.reg

It'll create a regular right click context menu for most if not all possible menus.

4.- Accept confirm authorization about it.

5.- Enjoiy it

Note: Change the text "ElevatedCMD" to whatever you want, this text will be displayed to execute the CMD, and if you added it and wants to change the text, only search in regedit, open it with Windows+R and type regedit and Enter, the regedit will open, search "ElevatedCMD" with ctrl+B(Finder) and F3(Next) and edit any concurrency.

4

The easiest way I know of is to simply install CmdOpen. I know you're trying to avoid installing something, but this is a 46 KB install, and the shell extensions themselves are less than 20 KB each (1 for 32-bit, 1 for 64-bit). It's also got some other useful features that you're not going to get out of the box.

It's certainly easier than struggling with registry edits -- especially if you're having problems.

afrazier
  • 23,505
1

I solved it adding this registry keys:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\Background\shell\openCmdHereAsAdmin]
@="Open command prompt here as admin"

[HKEY_CLASSES_ROOT\Directory\Background\shell\openCmdHereAsAdmin\command]
@="C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\powershell.exe -Command \"Start-Process cmd -ArgumentList '/s,/k,pushd,%V' -Verb RunAs\""

Save it on a .reg file and double click on the file to install it on your registry.

bluish
  • 495
0

If you don't want to install powertoys, try Ultimate Windows Tweaker. It's a one-run .exe that you can delete after.

tombull89
  • 6,699
0

How are you trying to import the .reg file?

The error message suggests you are using the IMPORT option in RegEdit

Try double clicking it in Windows Explorer.

Shevek
  • 16,738
-1

Just the see below link

Add Command prompt here to right click of mouse or in the context menu Every thing is described there.

-2

Just right click while holding Shift. The option will appear in the context menu.

-3

You don't need to add anything to Windows 7, the elevated command prompt is already included, just hold the shift key down when you right click in a folder, the context menu provides additional options, including the Admin command prompt.

If that doesn't work for you, the two reg files you linked to above do work. Make sure you only use Notepad to create the reg file as some text editors add formatting, which will cause problems.

Open a new Notepad text file copy and past the link from the first script then save the file as elecmd.reg Make sure the file file has not been saved with an additionl .txt extension. To check that, In Explorer, open the Tools menu/Folder Options/View/ Untick the box for 'Hide extensions of Known file types. Once confirmed, right click on the elecmd.reg file and select merge.

I've just been through that process and it does work.

Pulse
  • 4,589
  • 2
  • 21
  • 20