Problem solve Get help with specific problems with your technologies, process and projects.

RunAs takes different paths in Windows XP and Windows 2000

RunAs lets you run commands through an elevated account on the local computer. Read this tip to find out about the difference between the WinXP version and the Win2000 version.

Please let us know how useful you find this tip by rating it below. Do you have a useful Windows tip, timesaver or workaround to share? Submit it to our tip contest and you could win a prize!

RunAs is a useful tool that lets you run commands through an elevated account on the local computer. All you have to do is provide the appropriate user account and password information.

RunAs was first included with Windows 2000 and was carried over to Windows XP. There is, however, one major difference between the XP and 2000 versions. The Windows XP version only accepts running applications from a Universal Naming Convention (UNC) path, not a mapped drive letter. Windows 2000 accepts both.

For example, Windows XP will not work with the following command-line:

runas /user:<domain>\ <user name>

However, it will work with the following:
runas /user: <domain>\ <user name>

Unlike XP, Windows 2000's RunAs implementation doesn't enforce the mapped-drive credentials. Therefore, a Windows 2000 user can access a mapped drive by using another user's security context.

In the Explorer interface, holding down the shift key and right-clicking on a program or program shortcut inserts the RunAs command into the right-click menu.

Once you select the RunAs option, the following screen displays, letting you choose a different account to run the program:

RunAs also includes a command-line interface, allowing you to batch together commands to run programs with elevated privileges from a command line.

RunAs command-line options:


RUNAS [ [/noprofile | /profile] [/env] [/netonly] ]
/user:<UserName> program

RUNAS [ [/noprofile | /profile] [/env] [/netonly] ]
/smartcard [/user: <UserName>] program

Specifies that the user's profile should not be loaded, This causes the application to load more quickly, but can cause some applications to malfunction.

Specifies that the user's profile should be loaded. It is the default.

To use current environment instead of the user's.

To use if the credentials specified are for remote access only.

To use credentials previously saved by the user. This option is not available on Windows XP Home Edition and will be ignored.

To use if the credentials are to be supplied from a smartcard.

<UserName> should be in form USER@DOMAIN or DOMAIN\USER

The command line for EXE. See below for three examples:
-- runas /noprofile /user:mymachine\administrator cmd
-- runas /profile /env /user:mydomain\admin "mmc %windir%\system32\dsa.msc"
-- runas /env / "notepad \"my file.txt\""

Lastly, please note the following:
Enter the user's password only when prompted.
USER@DOMAIN is not compatible with /netonly.
/profile is not compatible with /netonly.

Rod Trent, manager of and a Microsoft MVP, is an expert on Microsoft Systems Management Server. He has more than 18 years of IT experience -- eight of which have been dedicated to SMS. He is the author of Microsoft SMS Installer, Admin911: SMS, and IIS 5.0: A Beginner's Guide and has written, literally, thousands of articles on technology topics.

Dig Deeper on Windows legacy operating systems

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.