I usually prefer to keep work and leisure accounts separated.

But let's say I need to access a program I installed on one from the other. The way I need to do it is by running the program as the respective other user (because otherwise, the stupid application won't recognise the license used to activate it and ask for another).

No big deal, I can shift-rightclick the application and run as the other by entering user name and password.

However, it'd be much more convenient if I could just left-click the application and it'd ask me for that specific user's password. Is there a way to manipulate the shortcut so it will do that?

(Ideally, of course, it wouldn't even ask for the password, but I sincerely doubt there's a way to set it up like that).

  • @Twisty that worked, thank you. (Though I should mention it's not necessary to create a batch file for it.) Do you want to extend your comment into an answer? – User1291 May 23 '17 at 11:39

You can create a batch script that starts your program using the Runas command. For example:

@runas /user:someuser "C:\Program Files\Folder\MyProgram.exe"

Then create a shortcut to this script. When executed, it will prompt you for the password to the specified user account.

If you want to avoid the password prompt, add the /savecred switch:

@runas /savecred /user:someuser "C:\Program Files\Folder\MyProgram.exe"

The first time you execute this you'll be prompted for the account password, which will then be saved in the Windows Credential Manager. Subsequent launches of the command will not prompt for a password (unless you delete the entry from the Credential Manager).

Note that you can also directly enter above commands (without the @) into a shortcut's "target" property, either when editing an existing shortcut or when creating a new one. Windows will then automatically rewrite runas into the proper path s.t. the shortcut's target will read - for example -

C:\Windows\System32\runas.exe /user:someuser "C:\Program Files\Folder\MyProgram.exe"

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.