Skip to content

Instantly share code, notes, and snippets.

@udoprog
Created June 14, 2019 16:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save udoprog/fce6298fcbaf372674564952e101c1ef to your computer and use it in GitHub Desktop.
Save udoprog/fce6298fcbaf372674564952e101c1ef to your computer and use it in GitHub Desktop.
Handle upgrading and downgrading GTA V
param([switch] $Downgrade=$false)
$Profile = "$env:USERPROFILE\Documents\Rockstar Games\GTA V"
$Game = "D:\Steam\steamapps\common\Grand Theft Auto V"
$SocialClub = "C:\Program Files\Rockstar Games\Social Club"
if (!(Test-Path -Path $Profile)) {
exit
}
if ($Downgrade) {
$ProfileSource = "$Profile\versions\1.27"
$ProfileDest = "$Profile\versions\latest"
$GameVersion = "$Game\versions\1.27"
$SocialClubInstaller = "$Game\versions\Social-Club-v1.1.7.8-Setup.exe"
} else {
$ProfileSource = "$Profile\versions\latest"
$ProfileDest = "$Profile\versions\1.27"
$GameVersion = "$Game\versions\latest"
$SocialClubInstaller = "$Game\Installers\Social-Club-Setup.exe"
}
if ((Test-Path -Path $Profile\Profiles) -and !(Test-Path -Path $ProfileDest\Profiles)) {
Move-Item -Path $Profile\Profiles -Destination $ProfileDest\Profiles
}
if (!(Test-Path -Path $Profile\Profiles)) {
Move-Item -Path $ProfileSource\Profiles -Destination $Profile\Profiles
}
if ((Test-Path -Path $Profile\settings.xml) -and !(Test-Path -Path $ProfileDest\settings.xml)) {
Move-Item -Path $Profile\settings.xml -Destination $ProfileDest\settings.xml
}
if (!(Test-Path -Path $Profile\settings.xml)) {
Move-Item -Path $ProfileSource\settings.xml -Destination $Profile\settings.xml
}
Get-ChildItem $GameVersion | Copy -Destination $Game -Recurse -Force
if (Test-Path -Path $SocialClub) {
Start-Process -FilePath $SocialClub\uninstallRGSCRedistributable.exe -Wait
}
if (!(Test-Path -Path $SocialClub)) {
Start-Process -FilePath $SocialClubInstaller -Wait
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment