Home > Sample chapters > Windows

Adding, Removing, and Managing Programs in Windows 7

Running a Program as an Administrator or Another User

As mentioned earlier in this chapter, you can run a program as an administrator by right-clicking any shortcut for the program (in the Start menu or elsewhere), choosing Run As Administrator, and satisfying the UAC prompt with either consent or credentials. Here are two additional ways to do it:

  • Start a Command Prompt session as Administrator (by right-clicking a shortcut for Cmd.exe and choosing Run As Administrator). Then, in the Command Prompt window, type the name of the executable file for whatever program you want to run as an administrator. To run Registry Editor, for example, type regedit. Because you’ve already passed UAC inspection for the Command Prompt session, and because whatever you run from Command Prompt is a child process of Command Prompt, you don’t have to deal with any further UAC prompts. This method is excellent for situations where you need to run a sequence of programs as an administrator. Keep one administrative-level Command Prompt window open, and run your programs from the command line.

  • Type the name of the program you want to run in the Start menu search box, and then press Ctrl+Shift+Enter.

To run a program under a different user account, you can right-click the program shortcut and choose Run As Different User from the shortcut menu. You will be prompted to enter the password for the specified user account. Alternatively, you can use the runas command from the Command Prompt window or a shortcut. The syntax is

runas /user:username programname

After you issue the command or activate the shortcut, you’ll be prompted to enter the password for the specified user account. For security reasons, you cannot save the password with the shortcut. Note that the Runas command does not work with Windows Explorer or with Microsoft Management Console (MMC) snap-ins.