Skip to content

Instantly share code, notes, and snippets.

@pirpyn
Last active May 8, 2023 18:10
Show Gist options
  • Save pirpyn/58dcce2e80f9edb7cf3d674627b39101 to your computer and use it in GitHub Desktop.
Save pirpyn/58dcce2e80f9edb7cf3d674627b39101 to your computer and use it in GitHub Desktop.
Install the Elden Ring Coop mod by saving this script (download zip) and execute it
@echo off
setlocal
for /f "usebackq tokens=1,2,*" %%B IN (`reg query "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v Desktop`) do set DESKTOP=%%D
for /f %%i in ('echo %DESKTOP%') do set DESKTOP=%%i
if NOT EXIST "%DESKTOP%/" (
echo error: Desktop not found
goto :END
)
echo Desktop found at %DESKTOP%
cd "%APPDATA%"
set "version=1.5.1"
set "archive=%APPDATA%\eldenringcoop_v%version%.zip"
IF NOT EXIST "%archive%" (
echo [1/5] Downloading the mod from Github ^(%version%^)
call:Download "https://github.com/LukeYui/EldenRingSeamlessCoopRelease/releases/download/v.%version%/betarealeasecoop%version%.zip" "%archive%"
) ELSE (
echo [1/5] %archive% already downloaded
)
if NOT EXIST "%archive%" (
echo error: Download failed
goto :END
)
set "tempdir=%APPDATA%\eldenringcoop_v%version%"
if NOT EXIST "%tempdir%\" (
echo [2/5] Unziping archive
powershell Expand-Archive "%archive%" -DestinationPath "%tempdir%"
)
if NOT EXIST "%tempdir%\" (
echo error: Unziping failed
goto :END
)
set "eldenringdir=C:\Program Files (x86)\Steam\steamapps\common\ELDEN RING\Game"
if NOT EXIST "%eldenringdir%\" (
set "eldenringdir=C:\Program Files\Steam\steamapps\common\ELDEN RING\Game"
)
if NOT EXIST "%eldenringdir%\" (
ECHO error: Elden Ring's Steam folder not found
goto :END
)
if NOT EXIST "%eldenringdir%\launch_elden_ring_seamlesscoop.exe" (
echo [3/5] Moving files to Steam folder
xcopy /S "%tempdir%" "%eldenringdir%"
) ELSE (
echo [3/5] Updating mod ^(removing old files^)
xcopy /Y "%eldenringdir%\SeamlessCoop\seamlesscoopsettings.ini" "%tempdir%\SeamlessCoop\seamlesscoopsettings.ini"
rmdir /S /Q "%eldenringdir%\SeamlessCoop"
xcopy /Y /S "%tempdir%" "%eldenringdir%"
)
if NOT EXIST "%eldenringdir%\launch_elden_ring_seamlesscoop.exe" (
echo error: Moving failed
goto :END
)
set "shortcut=%DESKTOP%\Elden Ring Coop.lnk"
if NOT EXIST "%shortcut%" (
echo [4/5] Creating Desktop shortcuts
call:CreateShortcut "%eldenringdir%\launch_elden_ring_seamlesscoop.exe" "%shortcut%"
call:CreateShortcut "%eldenringdir%\SeamlessCoop\seamlesscoopsettings.ini" "%DESKTOP%\Elden Ring Coop Password.lnk"
) ELSE (
echo [4/5] Shortcuts created
)
if NOT EXIST "%shortcut%" (
echo error: Shortcuts creation failed
)
echo Please set a coop password after 'cooppassword = '
notepad.exe "%eldenringdir%\SeamlessCoop\seamlesscoopsettings.ini"
goto :END
:CreateShortcut
@echo off
(
echo $SourceFilePath = %1
echo $ShortcutPath = %2
echo $WScriptObj = New-Object -ComObject ^("WScript.Shell"^)
echo $shortcut = $WscriptObj.CreateShortcut^($ShortcutPath^)
echo $shortcut.TargetPath = $SourceFilePath
echo $Shortcut.WorkingDirectory = "%eldenringdir%"
echo $shortcut.Save^(^)
) > shortcut.ps1
powershell -executionpolicy remotesigned -File shortcut.ps1
del shortcut.ps1
goto :EOF
:Download
set "URL=%1"
set "SaveAs=%2"
powershell "Import-Module BitsTransfer; Start-BitsTransfer '%URL%' '%SaveAs%'"
goto :EOF
:END
echo [5/5] Removing temporary files
:: if EXIST "%tempdir%" rmdir /S /Q "%tempdir%"
echo End of the script
pause
goto :EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment