|
@echo off |
|
|
|
:: This script automates several setup tasks on a Windows machine. |
|
:: It adjusts visual effects, installs Chocolatey (a package manager), |
|
:: and then uses Chocolatey to install popular software. |
|
|
|
:: --- Part 0: Configuration Variables --- |
|
:: Define the list of Chocolatey packages to install. |
|
set "CHOCO_PACKAGES=googlechrome git vscode notepadplusplus" |
|
:: You can easily add or remove packages here by separating them with spaces. |
|
|
|
:: --- Part 1: Adjust Visual Effects and Desktop Icons --- |
|
:: This section modifies Windows Registry settings. |
|
:: It aims to set visual effects to a specific value and show "This PC" icon on desktop. |
|
|
|
powershell -NoProfile -ExecutionPolicy Bypass -Command ^ |
|
"New-Item -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects' -Force | Out-Null; " ^ |
|
"Set-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects' -Name 'VisualFXSetting' -Value 2; " ^ |
|
"New-Item -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel' -Force | Out-Null; " ^ |
|
"Set-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel' -Name '{20D04FE0-3AEA-1069-A2D8-08002B30309D}' -Value 0" |
|
|
|
:: --- |
|
|
|
:: --- Part 2: Install Chocolatey Package Manager --- |
|
:: This section downloads and installs Chocolatey, a command-line package manager for Windows. |
|
:: It also adds Chocolatey's binary directory to the system's PATH environment variable |
|
:: for the current command prompt session. |
|
|
|
powershell -NoProfile -ExecutionPolicy Bypass -Command "[System.Net.ServicePointManager]::SecurityProtocol = 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin" |
|
:: The 'powershell -Command "..."' executes the Chocolatey installation script. |
|
:: The '&&' (batch operator) ensures the next command runs ONLY if the PowerShell command succeeds. |
|
:: 'SET "PATH=..."' adds Chocolatey's install directory to the current session's PATH, |
|
:: making 'choco' command available immediately. |
|
|
|
:: --- |
|
|
|
:: --- Part 3: Install Software using Chocolatey --- |
|
:: This command uses Chocolatey to silently install multiple applications from the defined list. |
|
:: The '-y' flag automatically confirms any prompts during installation. |
|
|
|
choco install %CHOCO_PACKAGES% -y |
|
:: Installs the packages listed in the CHOCO_PACKAGES variable. |
|
|