echo off
rem  **********************************************************************
rem  **********************************************************************
rem  START-EASY-UPDATE (PERIDATA)
rem  This batch file processes an UPDATE of the PERIDATA program by
rem  COPYING the new files to the program directory and the exchange directory
rem  It works only on PRIORILY INSTALLED programs, because only changed files are 
rem  updated and registry and environmental settings are not renewed
rem  
rem  
rem  Note: Start this file with ADMIN PRIVILEGES.
rem
rem  Note: The uninstallation files are not updated. Uninstall procedure 
rem  may be incomplete after EASY UPDATE.
rem   
rem  **********************************************************************

echo.
echo  **********************************************************************
echo  START-EASY-UPDATE (PERIDATA)
echo  **********************************************************************
echo.



rem check Admin PRIVILEGES
NET SESSION >nul 2>&1
IF %ERRORLEVEL% EQU 0 goto JUMP1
echo  *****
ECHO  ERROR - NO ADMIN PRIVILEGES. Please start the Batch file again AS ADMINISTRATOR !
echo  *****
pause
exit

: JUMP1
rem check environmental variable
if exist %PeriDataProgDir%  goto JUMP2
rem else
echo  *****
echo  ERROR - The environmental variable  "PeriDataProgDir"  does not exist. Update not performed.
echo  *****
pause
exit

: JUMP2
echo EXIST

rem %~dp0 ist das aktuelle directory
xcopy %~dp0\Periwin\*.* 	%PeriDataProgDir%\*.* /R /Y
xcopy %~dp0\Gdt2Perimeter\*.*  C:\PeriDataExchange\*.* /R /Y
rem /q=quiet /f=force deletion of readonly files
del /q /f %PeriDataProgDir%\..\UPDATE\*.* 

echo.
echo  **********************************************************************
echo  Program directory: %PeriDataProgDir% 
echo  Files copied. Please check.
echo  **********************************************************************
echo.

pause
exit

: FEHLER1
