8 Replies Latest reply: May 15, 2014 9:52 AM by michaeljul _ RSS

    Batch files

    michaeljul _

      I have a dos batch file that I am using to run two projects, the first project's summary is being exported to excel and the sheet is being used in the second project. However, it seems that the second project starts running before the first one has completed exporting, and I get a pop-up that tells me that the sheet doesnt exist. How can I make the batch file 'wait' for say 10 seconds befor it starts running the second project? The batch file looks like this:

       

      CD

      L:

      CD L:MONARCHPROGRAM

      MONARCH.EXE "C:Documents and SettingsMJH001My Documents eebokCount bills and conts.prj" /pxall

      CD

      L:

      CD L:MONARCHPROGRAM

      MONARCH.EXE "C:Documents and SettingsMJH001My Documents eebokfinal.prj" /pxall

        • Batch files
          Nick Osdale-Popa

          the following may work basically it waits for the existence of your file before it continues, I'm assuming the first project is creating a new file. If not, there are several free "wait.com" type files that are used in batch files for pausing execution for a set time.

           

          CD

          L:

          CD L:MONARCHPROGRAM

          MONARCH.EXE "C:Documents and SettingsMJH001My Documents eebokCount bills and conts.prj" /pxall

          CD

          :LOOP

          IF EXISTS <YOUR FILE NAME> GOTO EXIT_LOOP

          GOTO LOOP

          :EXIT_LOOP

          L:

          CD L:MONARCHPROGRAM

          MONARCH.EXE "C:Documents and SettingsMJH001My Documents eebokfinal.prj" /pxall

           

          [size="1"][ April 27, 2004, 04:13 PM: Message edited by: Nick Osdale-Popa ][/size]

          • Batch files
            michaeljul _

            Hi Nick,

             

            Thanks, but it doesnt seem to work - it stops after the first project has generated the xls sheet - this is what my batch file looks like exactly after inserting your loop - if you can hint me what the command for waiting say 30 seconds is, then that may work better for me:

             

            CD

            L:

            CD L:MONARCHPROGRAM

            MONARCH.EXE "C:Documents and SettingsMJH001My Documents eebokCount bills and conts.prj" /pxall

            CD

            :LOOP

            IF EXISTS "C:Documents and SettingsMJH001My Documents eebok ills and conts.xls" GOTO EXIT_LOOP

            GOTO LOOP

            :EXIT_LOOP

            L:

            CD L:MONARCHPROGRAM

            MONARCH.EXE "C:Documents and SettingsMJH001My Documents eebokfinal.prj" /pxall

            • Batch files
              Bruce _

              Michael

               

              Try this out free program out. It can be found at [url="http://www.computerhope.com."]www.computerhope.com.[/url]  & is called sleep.exe.

               

              This is what I found when I had the same problem. I use a bat file with the 1st two commands:

               

              "D:program filesMonarchBatch FilesSleep.exe 14400

              "C:Program FilesMonarchProgramMonarch.exe" /prj:"D:program filesmonarchprojectsDemand.xprj" /pxall

               

              Make sure the delay is measured in seconds. I use 4 hours (=14400 seconds) to wait for the main frame to export.

               

              Good luck,

              • Batch files
                Nick Osdale-Popa

                That's the one I was thinking of.      Thanks, Bruce.

                • Batch files
                  Nick Osdale-Popa

                  OK, after a little testing I tried this:

                   

                  :Loop

                  dir <your filename>

                  if errorlevel 1 goto loop

                  :Exit_Loop

                   

                  see if that works without having to use "sleep".

                  • Batch files
                    Sandy McQuay

                    I know this may be a bit late, but here's what I've used:

                     

                    CD

                    L:

                    CD L:MONARCHPROGRAM

                    start /w MONARCH.EXE "C:Documents and SettingsMJH001My Documents eebokCount bills and conts.prj" /pxall

                    CD

                    L:

                    CD L:MONARCHPROGRAM

                    start /w MONARCH.EXE "C:Documents and SettingsMJH001My Documents eebokfinal.prj" /pxall

                     

                    The start /w tells the batch file to wait until the command (monarch.exe etc) has completed and exited before moving to the next command in the batch file.

                    • Batch files
                      Bruce _

                      Sandy

                       

                      Never too late for a good tip!

                      • Batch files
                        michaeljul _

                        Thanks to all of you - will go with Sandys solution - seems to be the 'cleanest', and it works beautifully