peterandthewolf Posted December 18, 2008 Share Posted December 18, 2008 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? Link to comment Share on other sites More sharing options...
ChangMinYang Posted December 18, 2008 Share Posted December 18, 2008 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.gstart /wait /b compiledscript.exe scriptparametersHowever 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() Link to comment Share on other sites More sharing options...
peterandthewolf Posted December 18, 2008 Author Share Posted December 18, 2008 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 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now