waffle.lord 0f0f6b03a1 fix update script
idk why I can't use copy item but who cares, bits transfer still works fine
2024-03-19 12:51:30 -04:00

30 lines
599 B
PowerShell

param(
[string]$source,
[string]$destination
)
Clear-Host
Write-Host "Stopping installer ..."
$installer = Stop-Process -Name "SPTInstaller" -ErrorAction SilentlyContinue
if ($installer -ne $null) {
Write-Host "Something went wrong, couldn't stop installer process'"
return;
}
Write-Host "Copying new installer ..."
Import-Module BitsTransfer
Start-BitsTransfer -Source $source -Destination $destination
Remove-Module BitsTransfer
# remove the new installer from the cache folder after it is copied
Remove-Item -Path $source
Start-Process $destination
Write-Host "Done"