Last active
July 25, 2023 14:23
-
-
Save JKamsker/0a346ef189b8f6f13d22caf323c93f7e to your computer and use it in GitHub Desktop.
ApgetWebInstall
This file contains hidden or 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
| # Set the URL of the ZIP file and the target directory | |
| $zipUrl = "https://apropatchcdn.blob.core.windows.net/patch-staging/apget/latest/apget.zip" | |
| # https://apropatchcdn.blob.core.windows.net/patch-staging/apget/latest/apget.zip" | |
| # https://apropatchcdn.blob.core.windows.net/patch-staging/apget/latest/apget.zip | |
| # $targetDirectory = "$env:USERPROFILE\Tools\Apget" | |
| $targetDirectory = Split-Path ($profile.CurrentUserAllHosts) | |
| $targetDirectory = Join-Path $targetDirectory "Tools" | |
| $targetDirectory = Join-Path $targetDirectory "Apget" | |
| # Remove the target directory if it exists | |
| if (Test-Path -Path $targetDirectory -PathType Container) { | |
| Remove-Item -Path $targetDirectory -Recurse -Force | |
| } | |
| # Create the target directory if it doesn't exist | |
| if (-not (Test-Path -Path $targetDirectory -PathType Container)) { | |
| New-Item -ItemType Directory -Path $targetDirectory -Force | |
| } | |
| # Download the ZIP file | |
| $zipFilePath = Join-Path $targetDirectory "apget.zip" | |
| Invoke-WebRequest -Uri $zipUrl -OutFile $zipFilePath | |
| # Extract the contents of the ZIP file to the target directory | |
| Expand-Archive -Path $zipFilePath -DestinationPath $targetDirectory -Force | |
| # Clean up the downloaded ZIP file | |
| Remove-Item -Path $zipFilePath -Force | |
| # if targetDirectory has exactly one child directory, move the items in the child directory to targetDirectory and remove child directory | |
| $childDirectories = Get-ChildItem -Path $targetDirectory -Directory | |
| if ($childDirectories.Count -eq 1) { | |
| $childDirectory = $childDirectories[0] | |
| Get-ChildItem -Path $childDirectory | Move-Item -Destination $targetDirectory | |
| Remove-Item $childDirectory -Recurse -Force | |
| } | |
| $apgetExe = Get-ChildItem -Path $targetDirectory -Filter "apget.exe" -Recurse | |
| # limit to the first result | |
| $apgetExe = $apgetExe[0] | |
| # Output a message indicating the operation is complete | |
| Write-Host "apget has been downloaded and extracted to $targetDirectory" | |
| # https://pastebin.com/raw/2KuxfsPn | |
| # Invoke-Expression (New-Object Net.WebClient).DownloadString('https://patch.apro.at/apget.ps1') | |
| # Invoke-Expression (New-Object Net.WebClient).DownloadString('https://pastebin.com/raw/2KuxfsPn') | |
| # Invoke-Expression (New-Object Net.WebClient).DownloadString('https://gist.githubusercontent.com/JKamsker/0a346ef189b8f6f13d22caf323c93f7e/raw/ApGet.ps1') | |
| & $apgetExe completion powershell --install | Out-String | Invoke-Expression | |
| # |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment