13

How can you run an application as another user in Windows 7? The only catch is that I don't want to have to hold down the shift key, right click on the application and choose Run as different user. I need it to automatically login using the login credentials I specify.

1
  • 1
    DO NOT DO THIS! There's a huge security flaw with "runas /savecred ...", as I described in my answer here: superuser.com/a/903881/229612 (and include a working solution to the problem of running a program with elevated rights).
    – C. M.
    Apr 20, 2015 at 17:27

3 Answers 3

7
  1. Create a shortcut to your executable.
  2. Modify the "Target" under the shortcut's properties to:

    runas /user:DOMAIN\USERNAME "path to executable"

Then, just use the shortcut when you want to run the program.

3
  • If you need to pass any arguments to the target executable, make sure to include them in within the quotation marks.
    – Sam
    Oct 1, 2013 at 6:11
  • 3
    what about the password? Oct 28, 2013 at 10:20
  • 1
    As the answer by @savecred below shows, you can use /savecred to do this. Example for your Target: C:\Windows\System32\runas.exe /savecred /profile /user:MyLaptop\MyOtherUser "C:\Users\MyOtherUser\AppData\Local\Microsoft\Teams\Update.exe --processStart \"Teams.exe\""
    – Jaxidian
    Sep 29, 2020 at 15:24
0

A script can be run as a task, but if we have to run an interactive application as another user, then creating a task does not work (as mentioned in https://superuser.com/a/903881/229612).

You will have to necessarily tick the box "Run whether user is logged on or not" and if you do that, the task will not show the user interface of the application.

The other approach of using runas with /savecred also has its own problems, as explained in that thread.

Dont know whether there is a solution for this.

0

Create a shortcut to your executable. Modify the "Target" under the shortcut's properties to:

runas /savecred /user:DOMAIN\USERNAME "path to executable"

  • Right click then Run As Administrator the first time you use the shortcut, enter your password in the cmd prompt and press enter.
  • Clicking the icon will then run as the user
0

Not the answer you're looking for? Browse other questions tagged .