You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

37 lines
1.4 KiB

$url = "https://www.gitea1.intx.com.au/jn/punkbin/raw/branch/master/win32-x86_64/tclsh901t.exe"
$output = "$(join-path $PSScriptRoot "..\src\runtime\tclsh901t.exe")"
if (-not(Test-Path -Path $output -PathType Leaf)) {
if ((Get-Service -name "BITS").Status -eq "Running") {
Write-Host "OK - BITS services is running"
} else {
#If not running we can get a misleading error such as 'MUI error'
Write-Host "WARNING - BITS service does not seem to be running"
$answer = Read-Host "Do you want to start the Background Intelligent Transfer Service (BITS)? (Type Yes to start service)"
if ($answer -match "yes") {
#restart requires admin - use script marked for admin
#Restart-Service BITS
#Start-Process -FilePath "cmd.exe" -ArgumentList "-NoExit -NoNewWindow -File bits.cmd"
Start-Process -FilePath "bits.cmd" -ArgumentList "-NoExit -NoNewWindow" -Wait
#cmd /c bits.cmd
} else {
write-host "Unable to download. Exiting script.."
exit 1
}
}
try {
#Invoke-WebRequest $url -OutFile
Import-Module BitsTransfer
Start-BitsTransfer -Source $url -Destination $output
Write-Host "Runtime saved at $output"
}
catch {
throw $_.Exception.Message
}
}
else {
Write-Host "Runtime already found at $output"
}