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>
m:\mydirectory\myproggie.exe

However, it will work with the following:
runas /user: <domain>\ <user name>
\\myserver\myshare\mydirectory\myproggie.exe

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 USAGE:

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

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

/noprofile
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.

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

/env
To use current environment instead of the user's.

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

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

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

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

program
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 /user:user@domain.microsoft.com "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 myITforum.com 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.
This was first published in April 2005

Dig deeper on Microsoft Windows XP Pro

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchVirtualDesktop

SearchWindowsServer

SearchExchange

Close