Brahadambal S wrote:
Hi,

Could anyone tell me how to execute a .bat or .exe file through Perl?
i.e, the perl code should invoke the executable. Thanks so much for your
help(in advance).

Perl has two standard ways:

1) system() function, which executes an external program and returns its exit status. This is documented under "perldoc -f system"

2) backticks (e.g. $result = `someprog`), which executes an external program and captures its output. This is documented under "perldoc perlop". A qx// is a synonym for backticks.

Both of these wait for the spawned process to terminate before returning.

If you want to execute the process asynchronously, the standard Unix approach is to use fork/exec or pipe open. I think these may be emulated on Windows by ActiveState's perl, and there's also a Win32::Process module that uses Windows API's for process spawning.

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to