Baldur’s Gate Enhanced Edition – Local save folder

Make Baldur’s Gate Enhanced edition portable.

The following batch file will create symbolic links to set your save folder to the game folder instead of “My Documents”. This is useful if you intend to play the game portable. For example from a USB stick if you intend to be moving between different computers.

In the original Baldur’s Gate you had your save files in your local path, this is a workaround to make the enhanced edition act the same way.

Instructions

  1. Move the following files from your “My Documents\Baldur’s Gate – Enhanced Edition” folder into the “Baldur’s Gate – Enhanced Edition” install folder
    • Baldur.lua
    • characters
    • mpsave
    • portraits
    • save
  2. Copy the following code into your favourite plain text editor or notepad or download it directly by right clicking the following link and selecting “Save link as”

    @ECHO OFF
    FOR /F "tokens=3 delims= " %%G IN ('REG QUERY "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v "Personal"') DO (SET MYDOCUMENTS=%%G)
    mkdir "%MYDOCUMENTS%\Baldur's Gate - Enhanced Edition"
    rmdir "%MYDOCUMENTS%\Baldur's Gate - Enhanced Edition\portraits"
    rmdir "%MYDOCUMENTS%\Baldur's Gate - Enhanced Edition\save"
    rmdir "%MYDOCUMENTS%\Baldur's Gate - Enhanced Edition\characters"
    rmdir "%MYDOCUMENTS%\Baldur's Gate - Enhanced Edition\mpsave"
    del "%MYDOCUMENTS%\Baldur's Gate - Enhanced Edition\Baldur.lua"
    pause
    mklink /d "%MYDOCUMENTS%\Baldur's Gate - Enhanced Edition\portraits" "%~dp0\portraits"
    mklink /d "%MYDOCUMENTS%\Baldur's Gate - Enhanced Edition\save" "%~dp0\save"
    mklink /d "%MYDOCUMENTS%\Baldur's Gate - Enhanced Edition\characters" "%~dp0\characters"
    mklink /d "%MYDOCUMENTS%\Baldur's Gate - Enhanced Edition\mpsave" "%~dp0\mpsave"
    mklink "%MYDOCUMENTS%\Baldur's Gate - Enhanced Edition\Baldur.lua" "%~dp0\Baldur.lua"
    pause
  3. Save it as anything.bat in your Baldur’s Gate Enhanced edition install folder.
  4. Run anything.bat when the black window says press any key to continue, do so until the window disappears.
  5. Check that the folders in your “My Documents\Baldur’s Gate – Enhanced Edition” now have a little arrow on their icons. This indicates that they are not the actual files/folders but symbolic links.
  6. When you move to a new computer run anything.bat again and start the game!

Baldur’s Gate 2 Enhanced editon

Repeat the same steps as above but for the folder “Baldur’s Gate II – Enhanced Edition” and instead copy and paste the following  or right click this and select “Save link as”.

@ECHO OFF
FOR /F "tokens=3 delims= " %%G IN ('REG QUERY "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v "Personal"') DO (SET MYDOCUMENTS=%%G)
mkdir "%MYDOCUMENTS%\Baldur's Gate II - Enhanced Edition"
rmdir "%MYDOCUMENTS%\Baldur's Gate II - Enhanced Edition\portraits"
rmdir "%MYDOCUMENTS%\Baldur's Gate II - Enhanced Edition\save"
rmdir "%MYDOCUMENTS%\Baldur's Gate II - Enhanced Edition\characters"
rmdir "%MYDOCUMENTS%\Baldur's Gate II - Enhanced Edition\mpsave"
del "%MYDOCUMENTS%\Baldur's Gate II - Enhanced Edition\Baldur.lua"
pause
mklink /d "%MYDOCUMENTS%\Baldur's Gate II - Enhanced Edition\portraits" "%~dp0\portraits"
mklink /d "%MYDOCUMENTS%\Baldur's Gate II - Enhanced Edition\save" "%~dp0\save"
mklink /d "%MYDOCUMENTS%\Baldur's Gate II - Enhanced Edition\characters" "%~dp0\characters"
mklink /d "%MYDOCUMENTS%\Baldur's Gate II - Enhanced Edition\mpsave" "%~dp0\mpsave"
mklink "%MYDOCUMENTS%\Baldur's Gate II - Enhanced Edition\Baldur.lua" "%~dp0\Baldur.lua"
pause

Caveats

May require administrative rights on the computer you’re on.

After moving to another computer you may have to run the installer for the OpenAL codec once.


Robocopy sync multiple folders – to one location – batch script

From Wikipedia:

Robocopy, or “Robust File Copy“, is a command-line directory and/or file replication command. Robocopy functionally replaces Xcopy, with more options. It has been available as part of the Windows Resource Kit starting with Windows NT 4.0, and was first introduced as a standard feature in Windows Vista and Windows Server 2008.

This makes it a very useful simple syncing tool. The following is the script that I use to sync my laptop documents when I’m leaving the office. There are a lot of applications and tools for this but sometimes you just want a portable script.

Please note that this is a one-direction sync. It will not change or remove anything from the source folder.

robocopy-sync-unicode-folders

Instructions

  1. Copy and paste the following batch (*.bat) script into your favourite text editor of choice or notepad. (Not Microsoft word) You can also download it directly from here or here mirror. (You might have to right click and select save destination as)
    @echo off
    ::Unicode
    CHCP 1252
    echo %~dp0
    ::Remove old log file
    if exist "%~dp0\robocopylog.txt" del "%~dp0\robocopylog.txt"
    ::Ignore the following file types. You can add more separated by space
    set exclude=*.bak *.backup
    ::Go through each line in the folders.txt file
    for /f "skip=2 delims=" %%f in ('find /v "" %~dp0\folders.txt') do (
      ::Check if the relative path from current directory works 
      if exist "%~dp0\%%f" (
        ::Sync relative path
    		robocopy "%%f" "%~dp0\%%f" /v /xf %exclude% /mir /tee /fft /log+:robocopylog.txt
    	) else (
    	::Sync absolute path if relative didnt work
    		robocopy "%%f" "%~dp0\%%~nf" /v /xf %exclude% /mir /tee /fft /log+:robocopylog.txt
    	)
    )
    ::Wait for keyboard input before closing the window. Remove pause if you want it to close
    pause
    
  2. Save it where you want your backups to be stored (destination). Use whichever name you like. For example robocopy sync unicode folders.bat
  3. Create a new text file named folders.txt using any text editor and enter each folder that you want to make a backup off separated by a line break. (sources) Save the text file in the same folder as the batch script. Relative paths work too. Example:
  4. Run the script! The black window will stay open when it’s completed.
    With the above example the result would look something like this:

Notes

  • If source folders share the same name, they will be merged. Keep this in mind.
  • This is a one-direction only sync. It will not move or remove anything from the source folder.
  • If you don’t want the window to stay open when it’s complete remove the last line “pause” from the script.
  • A log file is saved for each operation in robocopylog.txt
  • You can add more files to exclude if you want, example: exclude=*.bak *.backup *.mp4 *.avi