Page 1 of 1

RUNAS with wait for process exit.

Posted: 21 Jul 2010 01:24
by k4p
Need to start process ("runas") with waiting for results (like "CALL" or "start /wait").. But, how do that? Thx..

Now use this construction:

1:
FOR "skip=3 tokens=1" %%i IN ('tasklist') DO IF %%i equ %wayted_process% GOTO 1


%-) have a simplest solve?

Re: RUNAS with wait for process exit.

Posted: 21 Jul 2010 08:25
by aGerman
I never used it, but did you try

Code: Select all

runas /user:XXXXX start "" /wait "xyz.exe"


Regards
aGerman

Re: RUNAS with wait for process exit.

Posted: 21 Jul 2010 09:50
by k4p
runas /user:test "start /wait calc.exe"

File not found: "start /wait calc.exe" :-)

Re: RUNAS with wait for process exit.

Posted: 21 Jul 2010 10:01
by aGerman
Of course. Have a look at the difference

Yours:
runas /user:test "start /wait calc.exe"

Mine:
runas /user:test start "" /wait "calc.exe"

Regards
aGerman

Re: RUNAS with wait for process exit.

Posted: 21 Jul 2010 10:16
by k4p
I tried that. Ofcourse RUNAS was return syntax error.

Re: RUNAS with wait for process exit.

Posted: 21 Jul 2010 10:29
by aGerman
Hmm, try to escape the quots.
runas /user:test "start \"\" /wait \"calc.exe\""

Otherwise write the entire path.

Regards
aGerman

Re: RUNAS with wait for process exit.

Posted: 21 Jul 2010 10:38
by k4p
aGerman, no.. equivalently :)

Re: RUNAS with wait for process exit.

Posted: 21 Jul 2010 11:55
by aGerman
Strange. Let's wait for the "runas-experts".

Regards
aGerman