How to run a program under different user's accounts?

2

My program C:\Program Files\MyApp\Myprog starts with Windows startup; at device insertion Myprog.exe invokes another program C:\Windows\comp.exe.
This process works fine in the admin account in which I install the programs but Myprog.exe is unable to invoke comp.exe when users account is changed.
I want C:\Windows\comp.exe to be invoke in each type of account e.g admin group accounts and non-admin accounts. Please help P.S both programs are not UAC patched.

Anas90

Posted 2015-06-09T05:05:25.283

Reputation: 23

Answers

1

In your exec-command inside the your application you could use the Windows built-in command runas.

For example:

runas /noprofile /user:mymachine\administrator "C:\Program Files\MyApp\Myprog.exe"

(you can probably omit the domain mymachine\ in your environment)


A different solution would be to make the comparison in a temporary directory with full access to the user, since it seams you try to do this in a protected directory on he system drive. - Maybe in the user's home.

Unfortunately I know nothing about "Myprog". But maybe you forgot to set the working directory of "comp.exe" so it tries to run inside C:\Windows which is of course protected from non-administrators.


runas reference same problem, solution with a batch file

Philipp

Posted 2015-06-09T05:05:25.283

Reputation: 76

How to specify password from command line? Or it is not required? – MiFreidgeim SO-stop being evil – 2018-09-03T03:47:57.390

You can use runas' /savecred flag in order to save the credentials of the other user to your account. – Philipp – 2018-09-04T05:04:02.440