Changed script to show running window.

Also added various checks for terminating process.
This commit is contained in:
Harrison Deng 2020-04-22 03:39:19 -05:00
parent 919c5201e4
commit 690abbdbe0
2 changed files with 9 additions and 4 deletions

View File

@ -1,3 +1,8 @@
$sID = Get-Item -Path ./pid.temp | Get-Content -Tail 1
Stop-Process -Id $sID
Remove-Item "./pid.temp"
if (Test-Path ./pid.temp) {
$sID = Get-Item -Path ./pid.temp | Get-Content -Tail 1
if (Get-Process -Id $sID -ErrorAction SilentlyContinue) {
Stop-Process -Id $sID
}
Remove-Item "./pid.temp"
}

View File

@ -1,3 +1,3 @@
$SID = Start-Process java -ArgumentList "-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=25566", "-Xms512M", "-Xmx1G", "-jar", "paper-195.jar" -NoNewWindow -PassThru
$SID = Start-Process java -ArgumentList "-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=25566", "-Xms512M", "-Xmx1G", "-jar", "paper-195.jar", "nogui" -PassThru
$SID = $SID.Id
$SID | Out-File -FilePath "pid.temp"