This is a modification of the Add Command Prompt Here tweak that is fairly common in the internet. What the original tweak basically did was, create a shortcut in the Directory/Drive Context Menu of Windows Explorer when clicked executes a command prompt with the clicked directory as current directory.

This modification was created so that I could run a root console from any directory or drive even when I was logged in as a restricted user. This can come in handy because then you can run many programs in restricted mode without re-login in as Administrator. Of course there is the Runas menu for executables, but you don't get it for Folders and directories.

What you have to do is simple. Copy and paste the following code in to notepad and save the resulting file in any name of ".reg" extension.
E.g. RootConsole.reg Then do a one time login as Administrator and double click the newly created .reg file. If all goes well, you should see a Shortcut called "Open Root Console Here" when you right click a Directory or Drive. When selected, it should ask you for the administrator password, and open up a Admin Console for you in the selected directory.

Note. You will have to replace COMPUTER_NAME with your computer name, and AdministratorName with your administrator account name.
E.G. My Computer name was Laptop
My administrator name was Administrator

Below is the reg file contents

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\cmd_root]
@="Open Root Console Here"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\cmd_root\command]
@="runas /user:COMPUTER_NAME\\AdministratorName \"Cmd.exe /k pushd %L\""

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Drive\shell\cmd_root]
@="Open Root Console Here"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Drive\shell\cmd_root\command]
@="runas /user:COMPUTER_NAME\\AdministratorName \"Cmd.exe /k pushd %L\""

Correction. You should have the Registry Version in the heading of the reg file. I missed that in the above post unfortunately. I think it differs depending on the windows OS version. But version 5.00 should be okay for Windows XP and above. I dont know about previous versions. You can find it by running regedit.exe from Start Menu + Run, and clicking Help + About Registry Editor.

This is the complete .reg file.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\cmd_root]
@="Open Root Console Here"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\cmd_root\command]
@="runas /user:COMPUTER_NAME\\AdministratorName \"Cmd.exe /k pushd %L\""

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Drive\shell\cmd_root]
@="Open Root Console Here"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Drive\shell\cmd_root\command]
@="runas /user:COMPUTER_NAME\\AdministratorName \"Cmd.exe /k pushd %L\""
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.