@echo off
cd /d %~dp0
setlocal enableextensions
if not exist ..\AirExplorer.exe goto noFiles
if not exist ..\AirExplorerCmd.exe goto noFiles
rd /s /q ..\$backup
md ..\$backup
if errorlevel 1 goto noRights
move ..\AirExplorer.exe ..\$backup\AirExplorer.exe
move ..\AirExplorerCmd.exe ..\$backup\AirExplorerCmd.exe
xcopy /e /h ..\Plugins ..\$backup\Plugins\
start /wait de4dot ..\$backup\AirExplorer.exe -o ..\AirExplorer.exe --dont-rename
start /wait de4dot ..\$backup\AirExplorerCmd.exe -o ..\AirExplorerCmd.exe --dont-rename
Patch-AirExplorer-pro /silent
echo.

:quit
pause
exit /b

:noRights
echo Please run %~nx0 as administrator.
goto quit

:noFiles
echo Put a folder from archive into app dir, run this file from there.
goto quit
