$process= New-Object System.Diagnostics.Process $process.StartInfo.Filename = "ping" $process.StartInfo.Arguments = "8.8.8.8" $process.StartInfo.RedirectStandardOutput = $True $process.StartInfo.UseShellExecute = $False $process.start() #$process.Kill() # kills the process $process.WaitForExit(); [string] $stdOut = $process.StandardOutput.ReadToEnd();
$process = Start-Process ping -ArgumentList "8.8.8.8" -wait -NoNewWindow -PassThru $process.HasExited $process.ExitCode
cmd /c ping 8.8.8.8