Can't force psexec to use the given user account

438 views Asked by At

I used to use runas for running my app under another user account. Now I need to pass the password through as well. I found that psexec is an easy way to do it.

So the batch file contains:

@echo off
psexec my.exe -u hostname\user -p password

The problem is my.exe is still being initiated under the user I'm currently logged onto the system with and not under the one declared in the cmd above.

1

There are 1 answers

4
Loïc MICHEL On BEST ANSWER

the program must be the last argument try this :

psexec -u hostname\user -p password my.exe