in reply to Re: How do I run a .bat file?
in thread How do I run a .bat file?

Perl already does that for you and does a better job of it. (:

        - tye (but my friends call me "Tye")

Replies are listed 'Best First'.
Re: Re: Re: How do I run a .bat file?
by Etelka (Novice) on Oct 25, 2001 at 05:08 UTC
    True, but this bat file is the only way we've can run this series of executables that expect input that we have. Even with all of the great information I've gotten here, I haven't been able to make it work. Perhaps I'll tell the engineer who wants me to write this that it can't be done with this particular file! ;-)

    Thanks again -
    ~E

      No, you misunderstood what I was saying. I was replying to this:

      In general, on a windows machine, you need to specify a binary executable. So you can't run .bat files directly.
      Which may be true in general of windows but isn't true of Perl's system(). Because:
      Fortunately, command.com does know how to run .bat files. So if you change your call to:
      system ("command.com /c d:\webmaster\cgi-bin\comb.bat");
      Well, that is the bit that "Perl already does that for you and does a better job of it". Perl already knows how to run command.com (or cmd.exe, depending on which version of Windows is involved) in order to execute programs that Win32's CreateProcess() call doesn't know how to run directly.

      Now, the bit of code quoted above made the same mistake you did. You need to double the backslashes in it.

      And I have no problem using system to run Windows batch files. If you have already tried doubling the backslashes and it still didn't work, then perhaps you should give us more details about how that failed and even include cut'n'pasted output from something like "dir d:\webmaster\cgi-bin\comb*" and what version of Perl you are using.

              - tye (but my friends call me "Tye")
      Perl can do pretty much anything batch files can do, and then some. What is this batch file doing, exactly?