Skip to content

Instantly share code, notes, and snippets.

@hugocorenzan
Last active April 29, 2026 00:08
Show Gist options
  • Select an option

  • Save hugocorenzan/d6a9fe30ca8777b30a15494dd55c23ab to your computer and use it in GitHub Desktop.

Select an option

Save hugocorenzan/d6a9fe30ca8777b30a15494dd55c23ab to your computer and use it in GitHub Desktop.

Game Launchers Installation Script

This PowerShell script automates the installation of several game launchers and creates symbolic links to redirect their installation directories to a specified games folder.

Prerequisites

  • Windows PowerShell: Ensure that PowerShell is available on your system.
  • Administrator Privileges: The script requires elevated permissions to create symbolic links and modify system folders.

Usage Instructions

  1. Download and Save the Script

    Save the script as a .ps1 file on your computer. For example, you can name it install_games.ps1.

  2. Open PowerShell as Administrator

    • Press Windows + X and select Windows PowerShell (Admin) from the menu.
    • Alternatively, search for "PowerShell" in the Start menu, right-click it, and choose Run as administrator.
  3. Navigate to the Script Location

    In PowerShell, use the cd command to change to the directory where the script is saved. For example:

    cd "C:\path\to\your\script"
  4. Run the Script

    Once you are in the correct directory, run the script by typing:

    .\install_games.ps1
  5. Follow the Prompts

    • The script will prompt you to enter the complete path to your games folder. Enter the path where you want all the game launchers to be installed, e.g., D:\Games.
    • If any directories already exist where symbolic links will be created, the script will ask for your confirmation before proceeding.
  6. Wait for the Script to Complete

    The script will automatically install the specified game launchers, create the necessary symbolic links, and manage the installation paths as needed.

Example Usage

  1. Save the script as install_games.ps1 in your desired folder.

  2. Open PowerShell as Administrator:

    • Press Windows + X and select Windows PowerShell (Admin) from the menu.
    • Alternatively, search for "PowerShell" in the Start menu, right-click it, and choose Run as administrator.
  3. Navigate to the script location:

    cd "C:\path\to\your\script"
  4. Run the script:

    .\install_games.ps1
  5. When prompted, enter your games folder path, such as D:\Games, and follow any additional prompts.

License

This script is provided "as is" without any warranty. Use it at your own risk.

# =============================================================================
# Game Launchers Installation Script
# =============================================================================
# This script installs several game launchers and creates symbolic links to
# redirect installation directories to a specified games folder.
# =============================================================================
# --- Function Definitions ---
# Function to check if a directory exists, and if not, create it
function Ensure-DirectoryExists {
param (
[string]$Path
)
if (-not (Test-Path -Path $Path)) {
New-Item -ItemType Directory -Path $Path -ErrorAction Stop
Write-Host "Created directory: $Path"
}
}
# Function to create a symbolic link, removing the existing source if necessary
function Create-SymbolicLink {
param (
[string]$Source,
[string]$Target
)
if (Test-Path -Path $Source) {
$removeSource = Read-Host "The path '$Source' already exists. Remove it to create the symbolic link? (Y/N)"
if ($removeSource -eq "Y" -or $removeSource -eq "y") {
Remove-Item -Path $Source -Recurse -Force
Write-Host "Removed existing path: $Source"
} else {
Write-Host "Cannot proceed without removing the existing path. Exiting script."
exit
}
}
New-Item -ItemType SymbolicLink -Path $Source -Target $Target -ErrorAction Stop
Write-Host "Created symbolic link from '$Source' to '$Target'"
}
# Function to install an application using Winget
function Install-Application {
param (
[string]$AppId,
[string]$InstallLocation,
[switch]$IgnoreLocationParameter
)
if ($IgnoreLocationParameter) {
winget install --id=$AppId -e
Write-Host "Installed $AppId without location parameter"
} else {
winget install --id=$AppId -e -l $InstallLocation
Write-Host "Installed $AppId to $InstallLocation"
}
}
# --- Main Script Execution ---
# Prompt user for the games folder path
$gamesPath = Read-Host "Enter the complete path to your games folder (e.g., D:\Games)"
$gamesPath = $gamesPath.TrimEnd("\\")
# Ensure the games folder exists
Ensure-DirectoryExists -Path $gamesPath
# Define program files paths
$programFilesX86 = "${env:ProgramFiles(x86)}"
# Define the symbolic link mappings
$linkMappings = @(
@{ Source = "$programFilesX86\Epic Games"; Target = "$gamesPath\Epic Games" },
@{ Source = "$env:LocalAppData\Amazon Games"; Target = "$gamesPath\Amazon Games" }
)
# Create necessary symbolic links
foreach ($mapping in $linkMappings) {
Ensure-DirectoryExists -Path $mapping.Target
Create-SymbolicLink -Source $mapping.Source -Target $mapping.Target
}
# Define the applications to install
$applications = @(
@{ Id = "Valve.Steam"; Location = "$gamesPath\Steam"; IgnoreLocation = $false },
@{ Id = "ElectronicArts.EADesktop"; Location = "$gamesPath\EA"; IgnoreLocation = $false },
@{ Id = "Amazon.Games"; Location = "$gamesPath\Amazon"; IgnoreLocation = $true },
@{ Id = "GOG.Galaxy"; Location = "$gamesPath\GOG Galaxy"; IgnoreLocation = $false },
@{ Id = "Ubisoft.Connect"; Location = "$gamesPath\Ubisoft"; IgnoreLocation = $false },
@{ Id = "RiotGames.Valorant.BR"; Location = "$gamesPath\Riot"; IgnoreLocation = $false },
@{ Id = "Blizzard.BattleNet"; Location = "$gamesPath\Battle.net"; IgnoreLocation = $false },
@{ Id = "EpicGames.EpicGamesLauncher"; Location = "$gamesPath\Epic Games"; IgnoreLocation = $true }
)
# Install each application using Winget
foreach ($app in $applications) {
Install-Application -AppId $app.Id -InstallLocation $app.Location -IgnoreLocationParameter:$app.IgnoreLocation
}
# =============================================================================
# Script Complete
# =============================================================================
Write-Host "All operations completed successfully!"
@hugocorenzan
Copy link
Copy Markdown
Author

Update to PowerShell script

@hugocorenzan
Copy link
Copy Markdown
Author

Add Battle.net

@hugocorenzan
Copy link
Copy Markdown
Author

Add links to fix the launchers that doesn't let us choose the installation folder

@hugocorenzan
Copy link
Copy Markdown
Author

Add user prompts to more user control and remove Rockstar launcher

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment