function StartWithExitCode($command, $arguments)
{
    #Write-Host "StartWithExitCode started!"
    #$cmdString = "cmd"
    #$argList = "/c start "+[char]34+$title+[char]34+" "+ [char]34+$command+[char]34
    #Start-Process $cmdString -ArgumentList $argList
    
    $pinfo = New-Object System.Diagnostics.ProcessStartInfo
    $pinfo.FileName = $command
    $pinfo.RedirectStandardError = $true
    $pinfo.RedirectStandardOutput = $true
    $pinfo.UseShellExecute = $false
    $pinfo.Arguments = $arguments

    $p = New-Object System.Diagnostics.Process
    $p.StartInfo = $pinfo
    $p.Start() | Out-Null
    $p.WaitForExit()
    
    return $p.ExitCode    
}