Launch windows exe from perl

T

Troot

Hi,

Im trying to launch an application (exe) from perl once I've processed
a file, but I can't find the correct command. Could somebody point in
the right direction?

Appreciated
Troot

ps Do you know if there is a way to get Perl to wait until the opened
app is finished? Its cool if its too difficult to do.
 
P

Paul Lalli

Troot said:
Im trying to launch an application (exe) from perl once I've processed
a file, but I can't find the correct command. Could somebody point in
the right direction?

The command you're looking for is 'system'. Read about it in:
perldoc -f system
ps Do you know if there is a way to get Perl to wait until the opened
app is finished? Its cool if its too difficult to do.

That is, in fact, the default behavior of system. If you wanted it to
not wait, you'd have to do some magic involving fork()...

Paul Lalli
 
P

Paul Lalli

Troot said:
cheers Paul, I was look everywhere for that ;o)

1) Please quote some context when replying to a Usenet group - not
everyone reads Usenet via a threaded interface.

2) When you're looking for a function, and you don't know its name, a
good place to start is:
perldoc perlfunc
which contains a list of all of Perl's functions, organized by
category.

Hope this helps,
Paul Lalli
 
J

jl_post

Paul Lalli replied:
That is, in fact, the default behavior of system. If you wanted
it to not wait, you'd have to do some magic involving fork()...


If you're using Win32, there's no need to use fork(). You can just
use the "start" command inside the call to system(), like this:

system("start notepad.exe");

This will start the "notepad.exe" application without halting the Perl
script.

-- Jean-Luc
 
P

Paul Lalli

Paul Lalli replied:


If you're using Win32, there's no need to use fork(). You can just
use the "start" command inside the call to system(), like this:

system("start notepad.exe");

This will start the "notepad.exe" application without halting the Perl
script.

Huh, good to know. I rarely program in Windows, so I'd never
encountered that. Thanks for the tip.

Paul Lalli
 
J

John Bokma

Paul Lalli said:
Huh, good to know. I rarely program in Windows, so I'd never
encountered that. Thanks for the tip.

Another one, if you want to open the current directory in a cmd.exe use:

start .
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,602
Members
45,182
Latest member
BettinaPol

Latest Threads

Top