Jared
Jared

Reputation: 39893

How do I run a Perl script in the background on Windows?

I have a Perl script that pops up a message box when its work is done. How can I run this in the background?

I looked at Proc::Background, but this requires launching a specific command. I'd like my code to run in the background without spawning a new process if possible.

Upvotes: 2

Views: 5978

Answers (4)

user36457
user36457

Reputation:

Consider running it as a service. There is a Perl script located here which will actually install it for you.

Alternatively, you could also try ExeService, a program which allows you to run executables, scripts, and commands as Windows services.

For further information on what a windows service is, see Windows service (Wikipedia).

Upvotes: 2

Byron Whitlock
Byron Whitlock

Reputation: 53901

If you have Perl 5.x, use fork. Fork is a built-in keyword and supported across all platforms.

Here is some sample code:

Re: Perl Background processes in Windows

Upvotes: 0

Dev
Dev

Reputation: 1

use Win32::GUI; 
BEGIN {
    Win32::GUI::Hide(scalar(Win32::GUI::GetPerlWindow()))
};

This will make your script work in the background

Upvotes: 0

Ronald Blaschke
Ronald Blaschke

Reputation: 4184

One way is to run the program with wperl, the Windows GUI version, instead of perl.

Upvotes: 8

Related Questions