PowerShell 结束端口


echo "======view 5000 point======";
$points=(netstat -ano | findstr 5000);
echo $points;

if($points.gettype().Name -eq "Object[]"){
    $points=$points.get(0);
}

echo "======kill 5000 point======";
$pids=-Split $points;
if($pids.length -gt 0) {
    taskkill /t /f /im $pids[$pids.length-1];
    echo "======kill success======";
}

echo "======create run bat file======";
$runscripts = "dotnet Hoa.Web.Host.dll --urls=http://*:8080";
$runscripts | Out-File "./run.bat";
posted @ 2020-06-08 09:13  百小僧  阅读(659)  评论(1编辑  收藏  举报