Skip to content

Instantly share code, notes, and snippets.

@aryomuzakki
Last active November 13, 2023 19:50
Show Gist options
  • Save aryomuzakki/40fa2149c97d9d53bfef92685379b5df to your computer and use it in GitHub Desktop.
Save aryomuzakki/40fa2149c97d9d53bfef92685379b5df to your computer and use it in GitHub Desktop.
Windows script or bat file or command line to install chocolatey and chocolatey packages. It is helpful to install applications/tools in new windows machine.
<!--
- how to use this file: https://docs.chocolatey.org/en-us/choco/commands/install#packages.config
- how to generate this file:
- from chocolatey packages repository with script builder: https://docs.chocolatey.org/en-us/community-repository/script-builder
- from other windows machine with export command: https://docs.chocolatey.org/en-us/choco/commands/export
-->
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="googlechrome" />
<package id="zoom" />
<package id="7zip" />
<package id="vlc" />
<package id="spotify" />
<package id="adobereader" />
<package id="telegram" />
<package id="firefox" />
</packages>
@REM This is a command line to use powershell to open/run other powershell process as admin, you will need to accept UAC prompt.
@REM This command will install chocolatey and then install chocolatey packages from a list in config file (<this_filename>-packages.config).
@powershell.exe Start-Process -Verb RunAs powershell -ArgumentList '-NoProfile -InputFormat None -Command "& {"^
"Set-ExecutionPolicy AllSigned; Set-ExecutionPolicy Bypass -Scope Process -Force;"^
"[System.Net.ServicePointManager]::SecurityProtocol = 3072;"^
"iex ((New-Object System.Net.WebClient).DownloadString(\\\"https://community.chocolatey.org/install.ps1\\\"));"^
"choco install \\\"%~dpn0-packages.config\\\" -y;"^
"Write-Host -NoNewLine \\\"Completed! Press any key to exit...\\\";"^
"$null = $Host.UI.RawUI.ReadKey(\\\"NoEcho,IncludeKeyDown\\\");"^
"}"'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment