Created
February 24, 2021 01:31
-
-
Save chowder/7f34e47749be69fa087731ed3c3285b7 to your computer and use it in GitHub Desktop.
PowerShell script to patch OSRS on Steam to launch RuneLite
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
# Self-elevate as admin (required to make symlinks later) | |
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { | |
Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs; | |
Exit | |
} | |
# Find RuneLite | |
$RuneliteAppPath = Get-StartApps -Name RuneLite | Select -ExpandProperty AppId | |
if (!$RuneliteAppPath) { | |
Write-Host "Could not find RuneLite application path." | |
Exit 1 | |
} | |
Write-Host "RuneLite application path: $RuneliteAppPath" | |
# Find Steam | |
$SteamInstallPath = Get-ItemProperty -Path Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Valve\Steam -Name InstallPath | Select -ExpandProperty InstallPath | |
if (!$SteamInstallPath) { | |
Write-Host "Could not find Steam installation path." | |
Exit 1 | |
} | |
Write-Host "Steam installation path: $SteamInstallPath" | |
# Find OSRS | |
$OsrsAppPath = "$SteamInstallPath/steamapps/common/RuneScape/bin/win64/RuneScape.exe" | |
# if (!$(Test-Path $OsrsAppPath -PathType Leaf)) { | |
# Write-Host "Could not locate OSRS application path." | |
# Exit 1 | |
# } | |
Write-Host "OSRS application path: $OsrsAppPath" | |
# Remove the current exe and symlink to RuneLite | |
try { | |
Remove-Item -Path $OsrsAppPath -Force -ErrorAction Continue | |
} | |
catch { } | |
cmd /c mklink /H "$OsrsAppPath" "$RuneliteAppPath" | |
Write-Host -NoNewLine 'Done. 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