@echo off

:: backup registry
REG DELETE "HKEY_CURRENT_USER\Software\KC Softwares\SUMo_backup" /f
REG COPY "HKEY_CURRENT_USER\Software\KC Softwares\SUMo" "HKEY_CURRENT_USER\Software\KC Softwares\SUMo_backup" /s /f
REG DELETE "HKEY_CURRENT_USER\Software\KC Softwares\SUMo" /f

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

:: backup local settings files
MOVE "%AppData%\KC Softwares\SUMo" "%AppData%\KC Softwares\SUMo_backup"
MKDIR "%AppData%\KC Softwares\SUMo"

:: copy portable settings files to host computer
XCOPY "%~dp0SUMo\*.*" "%AppData%\KC Softwares\SUMo\" /S /E