@echo off

MOVE "%HOMEDRIVE%\%HOMEPATH%\.FBREADER" "%HOMEDRIVE%\%HOMEPATH%\.FBREADER_backup"
MKDIR "%HOMEDRIVE%\%HOMEPATH%\.FBREADER"

COPY "%~dp0.FBREADER\*.*" "%HOMEDRIVE%\%HOMEPATH%\.FBREADER"

:: backup registry
REG DELETE "HKEY_CURRENT_USER\Software\FBReader_backup" /f
REG COPY "HKEY_CURRENT_USER\Software\FBReader" "HKEY_CURRENT_USER\Software\FBReader_backup" /s /f
REG DELETE "HKEY_CURRENT_USER\Software\FBReader" /f

:: restore registry
REGEDIT /S "%~dp0settings.reg"