Batch - Wait for the end of a process

Jerome -  
brucine Posted messages 24847 Registration date   Status Member Last intervention   -

Hello,

I am currently working on a batch file, at the beginning of which I launch an Excel file and my batch pauses, but I would like the batch to continue as soon as the file closes (even if other Excel files are open).
Is it possible?


2 answers

  1. brucine Posted messages 24847 Registration date   Status Member Last intervention   4 169
     

    Hello,

    If we anticipate the usage time of the file in question, is it timeout instead of pause?

    https://ss64.com/nt/timeout.html

    0
    1. Jerome
       

      Hello,

      Thank you for the response.

      But I know about timeout that I use anyway.

      It was more of a practical question that allows me to take the time to make my changes to the file. When it is closed, the batch command resumes automatically...

      0
      1. brucine Posted messages 24847 Registration date   Status Member Last intervention   4 169 > Jerome
         

        Hello,

        You have already reported the issue to me.

        In the link I mentioned in <3>, if I cannot pretend to rename the file because it is open, the error branch times out for 5 seconds and goes back to this renaming test ad vitam aeternam as long as RENAME, file closed, no longer causes an error and thus continues the batch.

        @echo off :start ren path-myxlsfile path-myxlsfile if errorlevel 1 goto errorline Rest of my batch goto end :errorline timeout /T 5 goto :start :end exit
        0
  2. Jerome
     

    Hello,

    Thank you for the reply.

    But I know about timeout that I use by the way.

    It was more of a practical question that allows me to take the time to make my modifications to the file. When I close it, the batch command automatically resumes...

    0