how to wait for a process to close before run another comman

Discuss and share scripts and script files...
Post Reply
Huidong
Posts: 213
Joined: 18 May 2011 21:55

how to wait for a process to close before run another comman

Post by Huidong »

I tried to run Malwarebytes update, wait for it to close, and then run a scan. Both execute the same mbam.exe with parameters /update and /scan, resp. I wonder how to wait for the first instance to end before running the second command. Thanks you!

Huidong
Posts: 213
Joined: 18 May 2011 21:55

Re: how to wait for a process to close before run another comman

Post by Huidong »

I noticed
run command, [directory], [wait=0]
, trying...

Huidong
Posts: 213
Joined: 18 May 2011 21:55

Re: how to wait for a process to close before run another comman

Post by Huidong »

no, using run ..., 1 does not work, the second command is run before the first instance is closed. Help please.

Huidong
Posts: 213
Joined: 18 May 2011 21:55

Re: how to wait for a process to close before run another comman

Post by Huidong »

It works to some extent:

Code: Select all

"Update and Quick scan"
  run """C:\Program Files\Malwarebytes' Anti-Malware\mbam.exe"" /update -silent", 1;
  msg "Update is done!";
  run """C:\Program Files\Malwarebytes' Anti-Malware\mbam.exe"" /scan -quick -terminate"
But I still have to press OK in response to the stupid message. Is there a way to avoid this?
Thanks!

Huidong
Posts: 213
Joined: 18 May 2011 21:55

Re: how to wait for a process to close before run another comman

Post by Huidong »

I was being careless.

Code: Select all

"Update and Quick scan"
  run """C:\Program Files\Malwarebytes' Anti-Malware\mbam.exe"" /update -silent", , 1;
  run """C:\Program Files\Malwarebytes' Anti-Malware\mbam.exe"" /scan -quick -terminate"
This works! The following is wrong!

Code: Select all

run """C:\Program Files\Malwarebytes' Anti-Malware\mbam.exe"" /update -silent", 1;

Post Reply