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.
3 Answers
- Create a shortcut to your executable.
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.
-
If you need to pass any arguments to the target executable, make sure to include them in within the quotation marks.– SamOct 1, 2013 at 6:11
-
3
-
1As 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\""
– JaxidianSep 29, 2020 at 15:24
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.
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