Running .bat files using Launch Application

Hi. I am using RPA Express to run a .bat file using the Launch Application action. This basically works, but the bot doesn’t know when the script is actually finished doing the job. So to make it work properly I’ve been adding more time to the Wait Up To parameter, but this is not optimal.

Is there any way for this action recognize when the .bat script has completed executing?

Hi @joe.turner
While the batch file is running is there anything visible on screen? If so, you can use a wait for image action after starting the .bat file and let the bot wait for any image or part of screen that appears when the .bat file is done.

1 Like

Hi - no, there is no window that comes up on screen when running this through RPAx.

How do you know that the .bat process has finished?

This is a script to extract contents of a .zip file to a folder. I know it’s finished if all of the contents have been extracted.

If you know beforehand which file or folder is extracted last in the extraction process you could use the check existence action with that. Put it into a while loop and keep checking until the boolean variable becomes true.
But that only works if you always know which file or folder to wait for before the process.

Unfortunately the contents of the .zip are dynamic, so I don’t think that approach would work in my case. Is there a way to determine the contents of a .zip?

I am not aware of any automated way to get the content of the .zip before extracting it.
But you could try something else: launch the unzip process with the .bat file and then monitor the size of the target folder where the files are extracted. When the size stops growing you can assume the extraction process is done.

You could use a loop like this:

While actual_size1 is not equal to actual_size2

  • Expression value write actual_size1 into actual_size2
  • Get Folder contents and write into var_list
  • Expression value for var_list - get size. Save size to actual_size1
1 Like

Good idea, I think that will work.

Thanks for your help.

1 Like