Sign in to follow this  
Followers 0
peterandthewolf

Synchronous script execution

3 posts in this topic

Hi all,

I have a autoit script that is called from a windows batch file and I would like the batch file to wait till the script has finished executing. The script (even compiled) seems to exit immediately and run asynchronously. Is there a way to compile the script so it executes synchronously? I found an old post that suggested using the windows start command e.g

start /wait /b compiledscript.exe scriptparameters

However this does not work as it is waiting for an asynchronous exe to run so returns immediately. I guess I could rewrite the windows batch file as an autoit script and use the RunWait or ProccessWaitClose... but then my batch file will be asynchronous. Chicken and egg :)

Any thoughts?

Share this post


Link to post
Share on other sites



Hi all,

I have a autoit script that is called from a windows batch file and I would like the batch file to wait till the script has finished executing. The script (even compiled) seems to exit immediately and run asynchronously. Is there a way to compile the script so it executes synchronously? I found an old post that suggested using the windows start command e.g

start /wait /b compiledscript.exe scriptparameters

However this does not work as it is waiting for an asynchronous exe to run so returns immediately. I guess I could rewrite the windows batch file as an autoit script and use the RunWait or ProccessWaitClose... but then my batch file will be asynchronous. Chicken and egg :)

Any thoughts?

Introduce this, ShellExecuteWait()

Share this post


Link to post
Share on other sites

Thanks GoodMan,

My solution was...

$PID = Run(".\compiledscript.exe " & $params)
ProcessWaitClose($PID)

but I like the ShellExecuteWait method better as can specify working directory.

Thanks again

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0