I have two problems:
I try to start a PERL program from a PowerShell. If I use a constant, it starts:
$Job1 = Start-Job { & “C:/Temp/Pause.pl” 10 }
If I try to construct my program name with a variable, it does not work:
$Cmd = “C:/Temp/Pause.pl”;
$Job1 = Start-Job { & $Cmd 10 }
#2
My PERL program looks like this, it basically justs waits for the number of seconds received as a parameter:
my $Delay = $ARGV[0];
print “Start $Delay\n”;
sleep $Delay;
print “End $Delai\n”;
When I start my PERL with this command, and I monitor the job’s state, I would expect to see RUNNING for the duration of the execution of my PERL script, but the job indicates COMPETED after only 1-2 seconds:
$Job1 = Start-Job { & “C:/Temp/Pause.pl” 10 }
For ($i=1; $i -le 15; $i++)
{
Get-Job
Start-Sleep -Seconds 1
}
Why does it indicate completed right away, even when my jobs running a PERL program is still running?