Use RunAs utility to execute a program from command line or batch file using a different user account.

RunAs command line utility is similar to Windows 2000/XP/2003/Vista native RunAs utility, but it has several distinct features making it much more usable than the native version:

  1. It accepts password as a command line parameter so that it can be used in batch files.
  2. It can bind started process to the interactive user Desktop so it can be used to start interactive processes from various services such as 24x7 Scheduler, 24x7 Event Server and other.
  3. Note: Professional version of RunAs also supports encryption of the entire command line, which administrators can use to give regular users access to certain programs requiring admin-level privileges. Users don't need to know the administrator's password and cannot use it to run anything else… simple, yet very efficient solution for this common problem.

 

DownloadDownload RunAs.exe (24 KB).

Here is the help screen containing complete description and examples

Usage (free version): RunAs <user> <password> [/V] [/B] [/I] <program name> [parameters]
Usage (professional version): RunAs /E <encrypted command line>

Command line parameters:


User Username in form DOMAIN\USER (for local accounts use .\USER format)
Password Password for the user account
/V Optional parameter. If specified, RunAs binds the process to the interactive user Desktop. (Use this parameter when starting interactive programs from services)
/B Optional parameter. If specified, RunAs prints only minimal diagnostic information to the screen in case of errors.
/I Optional parameter. If specified, RunAs makes the launched process inherit I/O handles of the RunAs console. Use this to redirect any input/outpup from/to external processes.
program name Full name of the program file to launch. If the name includes spaces, enclose the entire name in double quotes.
parameters Optional command line parameters that you want to pass to the program.

encrypted command line Complete command line including user, password, program name and optional parameters, all in encrypted non-readable format. Encrypted command line can be generated using professional version of RunAs utility.

Run RunAs.exe without parameters from the DOS command prompt to see full description of the supported parameters.