in reply to Re: Re: Re: How do I run a .bat file?
in thread How do I run a .bat file?
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: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.system ("command.com /c d:\webmaster\cgi-bin\comb.bat");
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")
|
|---|