Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi all, we have some important news to share. Please follow the link here to find out more!

https://www.boards.ie/discussion/2058419143/important-news/p1?new=1

Batch file to run processes asynchronously

  • 31-03-2011 10:04AM
    #1
    Registered Users, Registered Users 2 Posts: 7,541 ✭✭✭


    Morning all,

    My experience of writing batch scripts is limited to .bat files calling one or two processes synchronously. So looking to get some advice on something more complex.

    Environment is Windows Server 2008 and it has Powershell 2 installed if that's needed.

    What I'm looking to do is to create a batch file that can be called in a scheduled task.

    This batch file will in turn call several other batch files that must all run asynchronously (i.e. in parallel). These asynch batchfiles will contain a process that will extract data from an datasource into a .csv file and then sftp that .csv to a remote server. I'd like to log the output from each of these asynch batch files(i.e. success/error messages) to a text file. The main batch should also log its output to a text file.

    So I'm guessing I chould do something like:
    Main.bat:
    start async1.bat >> c:\some dir\output1.log
    start async2.bat >> c:\some dir\output2.log
    etc
    

    Is it as simple as that?? Or am I missing somthing?

    Also if I wanted some logic that will determine if the async batches ran correctly how do I do that? Analyse the output for key words (i.e. Error! Failure, etc) and act appropriately?

    Any advice welcome! Thanks


Advertisement