However, sometimes you need to run a simple command that requires system priviledges. Logging in and out or switching users is too much hassle. For this, I created a shortcut on the desktop and labeled it “RootShell.” (Bear in mind when you run commands from this shell that you have nearly complete control of the machine. With great power comes great responsibility.) The shortcut links to a batch file with the command:
runas /noprofile /env /user:MyMachine/MyAdmin cmd
UPDATE: There ought to be a backslash between MyMachine and MyAdmin. My blogging software helpfully deleted it. Grrr.
This batch file runs the command interpreter (cmd) as user “MyAdmin.” (Supply your own settings for ‘MyMachine’ and ‘MyAdmin’. In domain- and ActiveDirectory-controlled networks, the syntax will be slightly different for specifying the user. Type HELP RUNAS at a command shell for guidance.)
Double-clicking the icon opens a command shell and prompts for the administrator’s password. Get it correct, and the shell runs yet another shell in which you can type the commands you need to run. Get it wrong and it closes.
Handy and quick.