ARCHIVED: In Windows, how do I run an application as an alternate user?

This content has been archived, and is no longer maintained by Indiana University. Information here may no longer be accurate, and links may no longer be available or reliable.

Windows 7, Vista, and XP offer a Secondary Logon service (also known as "run as") that lets you run programs as different users. This tool is helpful in applying the principle of least privilege. For example, you can log into your computer as a normal user, and when you need to have administrative privileges to carry out a task, you can launch that program using the Secondary Logon service to select an administrative account.

You can use the Secondary Logon service in a couple of ways:

Run as...

In Windows 7 and Vista, by default, the Run as... option is not available. However, if you right-click an application, you can choose the Run as administrator option, which is typically followed by a User Account Control (UAC) prompt asking you to continue.

You can also download an external shell add-on that adds the Run as... feature to Vista; see ShellRunas.

In Windows XP, navigate to the program you'd like to launch with different privileges. Click it once to select it, and then hold down the Shift key and right-click the program. You'll see a contextual menu from which you can select Run as..., and then choose a different account.

Run

In Windows 7 and Vista, from the Start menu, enter run in the "Start Search" field. When the Run icon appears, click it. In XP, from the Start menu, select Run....

Enter the following command:

  runas /user:username cmd

Replace username with the name of the account you want to use. You can replace cmd with any command you'd like to run (if it contains spaces between characters, enclose it in double quotes). Click OK. When prompted, enter the password for the account you've chosen. This method will start a new command shell in a new session, from which you can launch programs.

For more information about the Windows Secondary Logon service, see articles 225035 and 305780 at the Microsoft Help and Support web site.

This is document amsq in the Knowledge Base.
Last modified on 2018-01-18 13:43:35.