Skip to content

Instantly share code, notes, and snippets.

@sempostma
Created October 15, 2023 20:11
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 sempostma/491fbffc0f54d22ac16aa73e25d8321e to your computer and use it in GitHub Desktop.
Save sempostma/491fbffc0f54d22ac16aa73e25d8321e to your computer and use it in GitHub Desktop.
Move RailWorks Steam workshop items to the RailWorks folder.
@ECHO off
SETLOCAL EnableDelayedExpansion
pushd %CD%
FOR /F "tokens=2* skip=2" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Steam App 24010" /v "InstallLocation"') DO set RW_INSTALL_LOCATION=%%b
ECHO.
ECHO Make sure you have 7zip installed!
ECHO Run this script as administrator, otherwise files may not be created/moved.
ECHO.
ECHO Found the RailWorks install directory here: %RW_INSTALL_LOCATION%
ECHO If this is not correct, please read: https://dutchsims.nl/viewtopic.php?f=55^&t=2597
ECHO.
cd /d %RW_INSTALL_LOCATION%
cd ..\..\workshop\content\24010
if not exist "%CD%\TEMP" mkdir %CD%\TEMP
set /a count = 1
for /r %%f in (*.zip) do (
set /a count += 1
tar -xf "%%f" --directory "%cd%\TEMP"
)
ECHO We successfully moved %count% workshop items to: %CD%\TEMP.
ECHO We will now try to copy those file to your RailWorks folder: %RW_INSTALL_LOCATION%.
ECHO You will be prompted to overwrite any files when duplicates are found.
ECHO.
XCOPY /w /-y /e /h "%CD%\TEMP" "%RW_INSTALL_LOCATION%"
ECHO.
ECHO We will now try to remove the temporary directory:
RMDIR /s "%CD%\TEMP"
POPD
ECHO End of script, you can now safely remove your Train Simulator workshop subscriptions.
PAUSE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment