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

My program C:Program FilesMyAppMyprog starts with Windows startup; at device insertion Myprog.exe invokes another program C:Windowscomp.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:Windowscomp.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.

Answer

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

For example:

runas /noprofile /user:mymachineadministrator “C:Program FilesMyAppMyprog.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