Last active
November 16, 2023 01:40
-
-
Save sethwololo/dea4f5b0e8af52ee96cb1ce0517308e1 to your computer and use it in GitHub Desktop.
PowerShell 7 version of my script to link games from steamapps/common to another folder
This file contains 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
$steamFolder = "C:\{PATH-TO-YOUR-STEAMAPPS/COMMON-FOLDER}" | |
$gamesFolder = "C:\{PATH-TO-YOUR-GAMES-FOLDER}" | |
function printArt { | |
Write-Host "`n" | |
Write-Host " ███████╗████████╗███████╗ █████╗ ███╗ ███╗ ███████╗██╗ ██╗███╗ ███╗██╗ ██╗███╗ ██╗██╗ ██╗" -ForegroundColor DarkCyan | |
Write-Host " ██╔════╝╚══██╔══╝██╔════╝██╔══██╗████╗ ████║ ██╔════╝╚██╗ ██╔╝████╗ ████║██║ ██║████╗ ██║██║ ██╔╝" -ForegroundColor DarkCyan | |
Write-Host " ███████╗ ██║ █████╗ ███████║██╔████╔██║ ███████╗ ╚████╔╝ ██╔████╔██║██║ ██║██╔██╗ ██║█████╔╝ " -ForegroundColor DarkCyan | |
Write-Host " ╚════██║ ██║ ██╔══╝ ██╔══██║██║╚██╔╝██║ ╚════██║ ╚██╔╝ ██║╚██╔╝██║██║ ██║██║╚██╗██║██╔═██╗ " -ForegroundColor DarkCyan | |
Write-Host " ███████║ ██║ ███████╗██║ ██║██║ ╚═╝ ██║ ███████║ ██║ ██║ ╚═╝ ██║███████╗██║██║ ╚████║██║ ██╗" -ForegroundColor DarkCyan | |
Write-Host " ╚══════╝ ╚═╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚══════╝ ╚═╝ ╚═╝ ╚═╝╚══════╝╚═╝╚═╝ ╚═══╝╚═╝ ╚═╝" -ForegroundColor DarkCyan | |
Write-Host "`n" | |
} | |
function LinkGames { | |
foreach ($game in Get-ChildItem -Directory $steamFolder) { | |
$gameName = $game.BaseName | |
if (Test-Path "$gamesFolder$gameName") { | |
Write-Host "Link to $gameName folder already exists." -ForegroundColor Yellow | |
} | |
else { | |
New-Item -Path "$gamesFolder$gameName" -ItemType SymbolicLink -Value $game -ErrorAction Stop | Out-Null | |
Write-Host "Link to $gameName folder created at $gamesFolder$gameName" -ForegroundColor Green | |
} | |
} | |
} | |
try { | |
Get-ChildItem $steamFolder -ErrorAction Stop --quiet | Out-Null | |
Get-ChildItem $gamesFolder -ErrorAction Stop --quiet | Out-Null | |
printArt | |
LinkGames | |
} | |
catch { | |
Write-Host $_.Exception.Message -ForegroundColor Red | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment