Running a Root/Administrator Console from any Folder

WolfPack 0 Tallied Votes 340 Views Share

This blog entry is regarding a registry hack for Windows XP. Be advised that twiddling with the registry requires care, and use the information here at your own risk. Backing up the registry before proceeding is adviced.

This is a based on 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 will open a Command Promt , ask you for the administrator password, and open up a Admin Console for you in the selected directory if the password given is correct.

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
You should have the Registry Version in the heading of the reg file. I think it differs depending on the windows OS version. But version 5.00 should be okay for Windows XP and above. I think REGEDIT4 should work for Windows 2000. 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\""