@echo on
cd %1
if exist "data\UpdateFile.zip" goto unzip
goto restart

:unzip
unzip -o "data\UpdateFile.zip" -d "data"
del "data\UpdateFile.zip" /S /F /Q
del "data\updateInfo.xml" /S /F /Q
xcopy "data\*.*" "..\" /E /C /I /R /Y

rd /s /q "data"
md "data"

goto restart

:restart
if "%2"=="0" goto end
cd ..
"%3"
goto end

:end
exit
