Last active
August 23, 2023 18:50
-
-
Save Jonathan727/eeb5a3942f4f1a271ebdad17c16b382f to your computer and use it in GitHub Desktop.
Download and install the latest version of notepad++
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Define the GitHub repository and release URL | |
$repo = "notepad-plus-plus/notepad-plus-plus" | |
$releaseUrl = "https://api.github.com/repos/$repo/releases/latest" | |
# Get the latest release information using the GitHub API | |
$releaseInfo = Invoke-RestMethod -Uri $releaseUrl | |
# Find the x64 installer asset | |
$installerAsset = $releaseInfo.assets | Where-Object { $_.name -like "*x64.exe" } | |
# Get the download URL for the installer | |
$installerUrl = $installerAsset.browser_download_url | |
# Define the local path in the temp directory where you want to save the installer | |
$localPath = Join-Path $env:TEMP "Notepad++Installer.exe" | |
# Use Invoke-WyebRequest to download the installer | |
Invoke-WebRequest -Uri $installerUrl -OutFile $localPath | |
Write-Host "Download completed. Installer saved to: $localPath" | |
# Ask the user if they want to install the downloaded file | |
$installChoice = Read-Host "Do you want to install Notepad++ (y/n)?" | |
if ($installChoice -eq "y" -or $installChoice -eq "Y") { | |
# Perform silent installation | |
Start-Process -FilePath $localPath -ArgumentList "/S" | |
Write-Host "Silent installation started." | |
} else { | |
Write-Host "Installation cancelled." | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment