----- Original Message -----
From: "Satish Vadlamani" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, June 08, 2001 4:46 PM
Subject: Question about how Win32::Process works


> Hi:
>
> 1) I want to know how Win32:Process works.
>
> 2)I am able to do what I want to do with the following program.  But I
have
> the perl icon is sitting on my the task bar.  I check the task manager and
I
> see two copies of cmd.exe and two copies of Perl5.6.0.exe running.  That
is,
> I am depending on perl to run the cmd.exe right?
>
> 3)  What I want is, perl should start these processes and then have
nothing
> to do with it.  How can I achieve that?
>
> 4) I would also like to know how the "inherit flag" can be used.  I set it
> to 1 and 0 and I am seeing same results.
>
> thanks in advance.
>
> Satish
>
> my $pid2;
>
>    if (!($pid2 = fork())) {
>
>       my $run_ha_db;
>       Win32::Process::Create($run_ha_db, 'C:\\perl\\bin\\Perl5.6.0.exe',
>                        "perl run_ha_db.pl", 0,
>                        CREATE_NEW_CONSOLE, ".");
>
>    }
>
>    else {
>
>       my $run_primary;
>       Win32::Process::Create($run_primary, 'C:\\perl\\bin\\Perl5.6.0.exe',
>                        "perl run_primary_aa.pl", 0,
>                        CREATE_NEW_CONSOLE, ".");
>    }
> _________________________________________________________________

Hi,
If it helps, I find that the following will produce a new cmd process and
window that is completely independent of perl (and any other processes).

Win32::Process::Create($ProcessObj,
"C:\\winnt\\system32\\cmd.exe",
"",
0,
CREATE_NEW_CONSOLE,
".") or die "Errors";

It has taken me quite a while (coz of stupidity) to work out how to have
that new console appear with a perl program running in it - but here it is:

$cmdline = "/k perl hello.pl";
Win32::Process::Create($ProcessObj,
"C:\\winnt\\system32\\cmd.exe",
$cmdline,
0,
CREATE_NEW_CONSOLE,
".") or die "Errors";

That will create the new console, entirely non-dependent upon any perl
processes - and with the output of 'hello.pl' displayed - or,with the
program running, if 'hello.pl' happens to be a continously running program.

For information on the structure of $cmdline, see Windows 'cmd' Help.

Cheers,
Rob

_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users

Reply via email to