# IT-Tools launcher: irm | iex # Downloads it.bat to %TEMP% and runs it in the current window. $ErrorActionPreference = 'Stop' $url = 'https://tools.accept-it.ru/bat' # link to it.bat $path = Join-Path $env:TEMP 'it.bat' try { Write-Host 'Downloading IT-Tools...' if (Get-Command curl.exe -ErrorAction SilentlyContinue) { # curl.exe follows https -> http redirects without complaints & curl.exe -sSL --fail --connect-timeout 15 -o $path $url if ($LASTEXITCODE -ne 0) { throw "curl exit code $LASTEXITCODE" } } else { [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 Invoke-WebRequest -Uri $url -OutFile $path -UseBasicParsing } $first = (Get-Content -Path $path -TotalCount 1) -replace "^$([char]0xFEFF)", '' if ($first -ne '@echo off') { throw 'Downloaded file is not it.bat (check the share link)' } # Run the menu right here, in the same window (errors stay visible) & cmd.exe /c $path if ($LASTEXITCODE -ne 0) { Write-Host "it.bat exited with code $LASTEXITCODE" -ForegroundColor Red } } catch { Write-Host "ERROR: $($_.Exception.Message)" -ForegroundColor Red }