Created
March 5, 2026 17:19
-
-
Save dalraf/c29cebb89fb2ec6738c8b8ce04aedff0 to your computer and use it in GitHub Desktop.
install apps winget
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
| # 1. Garantir que o script tenha privilégios e esperar a rede (opcional) | |
| Start-Sleep -Seconds 10 | |
| # 2. Registrar o Winget (App Installer) para o usuário atual | |
| # Às vezes, em instalações limpas, o comando 'winget' demora a ser reconhecido no PATH | |
| $AppInstaller = Get-AppxPackage -Name "Microsoft.DesktopAppInstaller" | |
| if ($null -eq $AppInstaller) { | |
| # Se não existir, o Windows 10/11 geralmente o possui mas precisa de ativação | |
| Add-AppxPackage -Register "C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller*\AppxManifest.xml" -DisableDevelopmentMode | |
| } | |
| # 3. Lista de IDs oficiais do Winget (mais estáveis que nomes) | |
| $apps = @( | |
| "Mozilla.Firefox", | |
| "Google.Chrome", | |
| "7zip.7zip", | |
| "WinRAR.WinRAR", | |
| "Microsoft.OpenJDK.11", # Alternativa estável ao JRE | |
| "Adobe.Acrobat.Reader.64-bit" | |
| ) | |
| # 4. Instalação Silenciosa | |
| foreach ($app in $apps) { | |
| Write-Output "Instalando: $app" | |
| # --accept-package-agreements evita interrupções de licença | |
| # --accept-source-agreements aceita os termos do repositório MS | |
| winget install --id $app --silent --accept-package-agreements --accept-source-agreements --force | |
| } | |
| # Limpeza opcional (ex: remover o próprio script após o uso) | |
| # Remove-Item $MyInvocation.MyCommand.Path |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment