Skip to content

Instantly share code, notes, and snippets.

@Jonathan727
Last active August 23, 2023 18:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Jonathan727/eeb5a3942f4f1a271ebdad17c16b382f to your computer and use it in GitHub Desktop.
Save Jonathan727/eeb5a3942f4f1a271ebdad17c16b382f to your computer and use it in GitHub Desktop.
Download and install the latest version of notepad++
# 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