Command line argument for running as another user on Windows?

Under windows .msi installer, if you specify a custom action to be run at an application's installation time, it will get run under the "SYSTEM" user. Can I trick it by passing a command line parameter to the custom action (.exe file) and make it run under the currently logged on user?

3 Answers

Is this what you are looking for?

RUNAS
Execute a program under a different user account.
Syntax RUNAS [/profile] [/env] [/netonly] /user:user Program
Key /profile Option to load the user's profile (registry) /env Use current environment instead of user's. /netonly Use the credentials specified only for remote connections. /user Username in form USER@DOMAIN or DOMAIN\USER (USER@DOMAIN is not compatible with /netonly) Program The command to execute

Enter the password when prompted.

When you start a program with RunAs /netonly, the program will execute on your local computer as the user you are currently logged on as, but any connections to other computers on the network will be made using the user account specified.

Without /netonly everything will run under the user account specified.

4

In the shortcut target space:

C:\Windows\System32\runas.exe /profile /user:COMPUTERNAME_04\administrator C:\totalcmd\TOTALCMD64.EXE

If you want to open any application other than Administrator, Please do as per below - Hold shift key + Right Click on the application. This will show option "Run As Different User"

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like