Use RunAs utility to execute a program from command line or batch file using a different user account.
Download 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.