同时运行多个启动过程

时间:2018-10-02 09:53:35

标签: powershell start-process

我有一个有效的脚本。它使用以下代码通过websocket预热我们的Web服务器。问题在于它只是顺序的。如何做到这4个进程同时运行?

$configurations = @'
    warmupHost,SERVERID
    host.domain.com,p1
    host.domain.com,p2
    host.domain.com,p1
    host2.domain.com,p2
'@ | ConvertFrom-Csv

$configurations | % {
    $socatProcess = Start-Process -FilePath .\websocat_win64.exe -Args "`"wss://${warmupHost}/atmosphere/warmupSessionId?url=https%253A%252F%252F${warmupHost}%252Fnosso&X-Atmosphere-tracking-id=0&X-Atmosphere-Framework=2.3.3-javascript&X-Atmosphere-Transport=websocket&X-Atmosphere-TrackMessageSize=true&X-atmo-protocol=true`" -n -H `"Cookie:SERVERID=${serverID}`"" -RSI .\login.json -PassThru
    echo $socatProcess
    Start-Sleep -s 5
    Stop-Process $socatProcess
}

0 个答案:

没有答案