4 Replies Latest reply: May 15, 2014 10:07 AM by Data Kruncher RSS

    Open multiple files in batch using a wild card

      Pro 9.01 on XP sp3

       

      Is there anyway to open multiple files in a project batch file using a wild card?  I've tried using a asterisk with the /rpt switch but it doesn't seem to work; for example:

       

      start /wait MONARCH  /prj:bc_era_BPR_extract.xprj /rpt:x230*.txt /pxall

       

      yields no results.  When I take the project export switch out I get an error saying "x230*.txt doesn't exist".

        • Open multiple files in batch using a wild card
          Olly Bond

          Hello Jim,

           

          The easiest way would be to use DataPump, which was designed for this sort of job, but there may be a way around it.

           

          The command:

           

          dir x230*.txt > listing.prn[/CODE]

           

          would direct the listing of all the required input files into a new text report.

           

          You can then use Monarch to open this report, and it's fairly easy to define a calculated field of the form:

           

          "C:\Program Files\...Monarch.exe" "rpt:...the path of each report file" /pxall" etc[/CODE]

           

          (Watch out to use chr(34) for " in the expression.)

           

          Then output this from Monarch as a fixed width text file called "newbatch.bat" and call it from your original batch file.

           

          HTH,

           

          Olly

          • Open multiple files in batch using a wild card
            Nick Osdale-Popa

            You could do something like this in one batch file:

            @echo off

            SETLOCAL

            For %%i in ("C:\FullPath\x230*.txt") Do Call :monarch "%%i"

            ENDLOCAL

            GOTO :EOF

             

             

            :monarch

            "C:\Program Files\Monarch\Program\Monarch.exe" /rpt:%1 /pxall

            GOTO :EOF[/code]

             

            This effectively does the same thing that Olly's NewBatch.bat routine would do, without the extra steps of running Monarch first.

              • Open multiple files in batch using a wild card
                Nick Osdale-Popa

                I was working with Data Kruncher through PM and it's come to my understanding that what you want to do is run all reports against the project file. To that end I came up with a better solutions to the problem:

                 

                @echo off

                SETLOCAL ENABLEDELAYEDEXPANSION

                (set reports=)

                 

                for %%i in ("C:\FullPath\x230*.txt") do (set reports=!reports! /rpt:%%i)

                 

                "C:\Program Files\Monarch\Program\Monarch.exe" /prj:bc_era_BPR_extract.xprj %reports% /pxall

                 

                ENDLOCAL[/code]

                This will put all files into the reports environment variable that is then passed to Monarch.

                • Open multiple files in batch using a wild card
                  Data Kruncher

                  I had a slightly different idea for this one: still a batch file, but I wanted to have the batch file build up the Monarch command line automatically.

                   

                  I struggled to get the syntax right, so, via PM, our resident batch file expert Nick kindly sorted it out to yield what I was attempting to accomplish, which is:

                   

                  See above: he beat me to posting it.

                   

                  Nick, you da man.