|
Re: FEATURE REQUEST: control over whether child processes block "Alex K. Angelopoulos [MVP]" <aka@online.mvps.org> wrote in message
news:OXykFkhvGHA.2120@TK2MSFTNGP03.phx.gbl...
> I suggest filing this as a feature request on Connect. For now, here's my
> workaround function:
Oops. Minor error in the function. I've fixed it and also added a timeout:
function Start-Process
{
Param(
[string]$Filename,
[string]$ArgumentString = [System.String]::Empty,
[switch]$Wait,
[int]$Timeout = 0)
$si = New-Object System.Diagnostics.ProcessStartInfo
$si.Filename = $Filename;
if($ArgumentString){$si.Arguments = $ArgumentString};
$ps = [System.Diagnostics.Process]::Start($si);
if($Wait){
if($Timeout -gt 0){$ps.WaitForExit($Timeout*1000)}
else{$ps.WaitForExit();}
}
$ps;
} |