@echo off

set PSQL=C:\Software\PostgreSQL\9.6\bin\psql.exe
set GZIP=C:\Software\7-Zip\7z.exe

set TMP_DIR=C:\temp\db.sql
set APP_NAME=suite
set ARCHIVE=%APP_NAME%_%1
set DATA_SRC_DIR=C:\data\%APP_NAME%


rem %GZIP% x -so %TMP_DIR%\%ARCHIVE%.tgz | %GZIP% x -si -o%TMP_DIR%\%ARCHIVE%  -ttar

rem xcopy %TMP_DIR%\%ARCHIVE%\data %DATA_SRC_DIR% /s /e /y

%PSQL% -U postgres -d template1 < %TMP_DIR%

rem rd /s/q "%TMP_DIR%\%ARCHIVE%"

rem echo Backup %ARCHIVE% restored


rem C:\Software\PostgreSQL\9.6\bin\psql.exe -U postgres -d template1 < C:\temp\db.sql