$ErrorActionPreference='Stop' $New='C:\Users\ytd_extdev_0903\incoming\jeecg-system-start-3.5.3.NEW.jar' $Incoming='C:\Users\ytd_extdev_0903\incoming\jeecg-system-start-3.5.3.jar' $Fat='E:\wwwroot\inquiry-new\jeecg-system-start-3.5.3.jar' if(-not (Test-Path $New)){ throw "missing $New" } $len=(Get-Item $New).Length Write-Host ("new_bytes="+$len) if($len -lt 170000000){ throw "new jar too small, incomplete upload" } # stop loops Get-CimInstance Win32_Process | ForEach-Object { if($_.CommandLine -and ($_.CommandLine -like '*inquiry-new*jeecg*' -or $_.CommandLine -like '*run-ledger*')){ Stop-Process -Id $_.ProcessId -Force -ErrorAction SilentlyContinue } } Start-Sleep -Seconds 2 Copy-Item $New $Incoming -Force Copy-Item $New $Fat -Force Write-Host 'COPIED_NEW_JAR' powershell -NoProfile -ExecutionPolicy Bypass -File C:\Users\ytd_extdev_0903\incoming\_remote_wmi_start_ledger.ps1