diff --git a/.gitignore b/.gitignore
index 0386e03..843ae7b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -27,3 +27,7 @@ pgadmin4.log
 /mac-build
 /src-build
 /dist
+/win-build
+runtime/Makefile.Debug
+runtime/Makefile.Release
+runtime/release/
diff --git a/Make.bat b/Make.bat
new file mode 100644
index 0000000..ab47491
--- /dev/null
+++ b/Make.bat
@@ -0,0 +1,456 @@
+@ECHO off
+SETLOCAL
+REM
+REM ****************************************************************
+SET WD=%CD%
+SET "PGBUILDPATH=%WD%\win-build"
+SET CMDOPTION=""
+IF "%1" == "clean"  SET CMDOPTION="VALID"
+IF "%1" == "x86"    SET CMDOPTION="VALID"
+IF "%1" == "amd64"  SET CMDOPTION="VALID"
+
+IF NOT %CMDOPTION%=="VALID"  ( GOTO USAGE )
+SET ARCHITECTURE=%1
+
+IF "%ARCHITECTURE%"=="clean" (
+    GOTO CLEAN_RELEASE
+    goto:exit
+)
+
+REM Main Functions
+
+call :SET_PGADMIN4_ENVIRONMENT
+IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
+
+call :CLEAN_RELEASE
+
+call :CREATE_VIRTUAL_ENV
+IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
+
+call :CREATE_RUNTIME_ENV
+IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
+
+call :CREATE_PYTHON_ENV
+IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
+
+call :CLEANUP_ENV
+IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
+
+call :CREATE_INSTALLER
+IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
+
+CD %WD%
+goto:EXIT
+REM Main function Ends
+
+:SET_PGADMIN4_ENVIRONMENT
+   REM Check os architecture x86 or amd64
+   SET RegQry=HKLM\Hardware\Description\System\CentralProcessor\0
+   REG.exe Query %RegQry% > checkOS.txt
+   Find /i "x86" < CheckOS.txt > StringCheck.txt
+   SET OSTYPE=""
+   IF %ERRORLEVEL% == 0 (
+        SET OSTYPE=x86
+    ) else (
+        SET OSTYPE=amd64
+    )
+    DEL CheckOS.txt StringCheck.txt
+    SET OSVALUE=""
+    IF "%OSTYPE%"=="x86" (
+        IF "%ARCHITECTURE%"=="amd64" (
+            ECHO ARCHITECTURE - %ARCHITECTURE% cannot be run on 32 bit machine
+            goto:exit
+        )
+        OSVALUE=%OSTYPE%
+    )
+
+    REM Check IF its is windows 32 bit machine and selected architecture is x86
+    IF %OSVALUE%=="x86" (
+        IF "%PYTHON_HOME%" == ""   SET "PYTHON_HOME=C:\Python27123"
+        IF "%PYTHON_DLL%" == ""    SET "PYTHON_DLL=C:\Windows\System32\python27.dll"
+        IF "%QTDIR%" == ""         SET "QTDIR=C:\Qt\Qt5.5.1\5.5\msvc2013"
+        IF "%PGDIR%" == ""         SET "PGDIR=C:\Program Files\PostgreSQL\9.5"
+        IF "%INNOTOOL%" == ""      SET "INNOTOOL=C:\Program Files\Inno Setup 5"
+        IF "%VCDIR%" == ""         SET "VCDIR=C:\Program Files\Microsoft Visual Studio 12.0\VC"
+        goto SKIPARCVALIDATION
+    )
+
+    REM Check IF its is windows 64 bit machine and selected architecture is x86 or amd64
+    IF "%ARCHITECTURE%"=="x86" (
+        IF "%PYTHON_HOME%" == ""   SET "PYTHON_HOME=C:\Python27"
+        IF "%PYTHON_DLL%" == ""    SET "PYTHON_DLL=C:\Windows\SysWOW64\python27.dll"
+        IF "%QTDIR%" == ""         SET "QTDIR=C:\Qt\Qt5.5.1\5.5\msvc2013"
+        IF "%PGDIR%" == ""         SET "PGDIR=C:\Program Files (x86)\PostgreSQL\9.5"
+        IF "%INNOTOOL%" == ""      SET "INNOTOOL=C:\Program Files (x86)\Inno Setup 5"
+        IF "%VCDIR%" == ""         SET "VCDIR=C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC"
+    )
+
+    IF "%ARCHITECTURE%"=="amd64" (
+        IF "%PYTHON_HOME%" == ""   SET "PYTHON_HOME=C:\Python27-x64"
+        IF "%PYTHON_DLL%" == ""    SET "PYTHON_DLL=C:\Windows\System32\python27.dll"
+        IF "%QTDIR%" == ""         SET "QTDIR=C:\Qt\5.5\msvc2013"
+        IF "%PGDIR%" == ""         SET "PGDIR=C:\Program Files\PostgreSQL\9.5"
+        IF "%INNOTOOL%" == ""      SET "INNOTOOL=C:\Program Files\Inno Setup 5"
+        IF "%VCDIR%" == ""         SET "VCDIR=C:\Program Files\Microsoft Visual Studio 12.0\VC"
+    )
+
+    :SKIPARCVALIDATION
+    REM SET the variables IF not availalbe in windows enviroment
+    SET VCVAR=%VCDIR%\vcvarsall.bat
+    SET VCNMAKE=%VCDIR%\bin\nmake.exe
+    SET QMAKE=%QTDIR%\bin\qmake.exe
+    SET VIRTUALENV=ve_python
+    SET TARGETINSTALLER=%WD%\dist
+
+    FOR /F "tokens=3" %%a IN ('findstr /C:"APP_RELEASE =" %WD%\web\config.py')    DO SET APP_RELEASE=%%a
+    FOR /F "tokens=3" %%a IN ('findstr /C:"APP_REVISION =" %WD%\web\config.py')   DO SET APP_REVISION_VERSION=%%a
+    FOR /F "tokens=3" %%a IN ('findstr /C:"APP_SUFFIX =" %WD%\web\config.py')     DO SET APP_SUFFIX_VERSION=%%a
+    REM remove single quote from the string
+    SET APP_SUFFIX_VERSION=%APP_SUFFIX_VERSION:'=%
+    SET APP_NAME=""
+    FOR /F "tokens=2* DELims='" %%a IN ('findstr /C:"APP_NAME =" web\config.py')   DO SET APP_NAME=%%a
+    SET INSTALLERNAME=%APP_NAME%-v%APP_RELEASE%.%APP_REVISION_VERSION%-%APP_SUFFIX_VERSION%-%ARCHITECTURE%.exe
+
+    SET PGADMIN4_VERSION=v%APP_RELEASE%
+    SET PGADMIN4_APP_VERSION=%APP_RELEASE%.%APP_REVISION_VERSION%
+
+    ECHO ****************************************************************
+    ECHO                        S U M M A R Y
+    ECHO ****************************************************************
+    ECHO Target mode = %ARCHITECTURE%
+    ECHO INNOTOOL    = %INNOTOOL%
+    ECHO VCDIR       = %VCDIR%
+    ECHO NMAKE       = %VCNMAKE%
+    ECHO QTDIR       = %QTDIR%
+    ECHO QMAKE       = %QMAKE%
+    ECHO PYTHON_HOME = %PYTHON_HOME%
+    ECHO PYTHON_DLL  = %PYTHON_DLL%
+    ECHO PGDIR       = %PGDIR%
+    ECHO ****************************************************************
+
+    REM Check IF path SET in enviroments really exist or not ?
+    IF NOT EXIST "%INNOTOOL%"          GOTO err_handle_inno
+    IF NOT EXIST "%VCDIR%"             GOTO err_handle_visualstudio
+    IF NOT EXIST "%VCVAR%"             GOTO err_handle_visualstudio
+    IF NOT EXIST "%VCNMAKE%"           GOTO err_handle_visualstudio
+    IF NOT EXIST "%QTDIR%"             GOTO err_handle_qt
+    IF NOT EXIST "%QMAKE%"             GOTO err_handle_qt
+    IF NOT EXIST "%PYTHON_HOME%"       GOTO err_handle_python
+    IF NOT EXIST "%PYTHON_DLL%"        GOTO err_handle_python
+    IF NOT EXIST "%PGDIR%"             GOTO err_handle_pg
+
+    REM Check for QT and VC dependences
+    FOR /L %%G IN (15,1,19) DO "%VCDIR%\bin\cl.exe" /? 2>&1 | findstr /C:"Version %%G" > nul && SET MSVC_MAJOR_VERSION=%%G && GOTO QT_MSVC
+
+    :QT_MSVC
+    IF %MSVC_MAJOR_VERSION%==19     SET QT_MSVC_PATH=msvc2015
+    IF %MSVC_MAJOR_VERSION%==18     SET QT_MSVC_PATH=msvc2013
+    IF %MSVC_MAJOR_VERSION%==17     SET QT_MSVC_PATH=msvc2012
+    IF %MSVC_MAJOR_VERSION%==16     SET QT_MSVC_PATH=msvc2010
+    IF %MSVC_MAJOR_VERSION%==15     SET QT_MSVC_PATH=msvc2008
+
+    REM on 64 bit machine if x86 is selected and QTDIR is set to 64 bit is should not allow
+    IF "%OSTYPE%"=="amd64" (
+        IF "%ARCHITECTURE%"=="x86" (
+         echo "%QTDIR%" | findstr /C:"_64" > nul && ( GOTO err_handle_qt_compactissue )
+        )
+    )
+
+    IF "%ARCHITECTURE%"=="amd64" (
+        SET QT_MSVC_PATH=%QT_MSVC_PATH%_64
+    )
+
+    IF NOT EXIST "%QTDIR%\..\%QT_MSVC_PATH%"       GOTO err_handle_qt_mismatch
+
+    REM get Python version ex. 2.7.1 will get as 27
+    for /f "tokens=1 DELims=." %%G IN ('%PYTHON_HOME%/python.exe -c "import sys; print sys.version.split(' ')[0]"') DO SET PYTHON_MAJOR=%%G
+    for /f "tokens=2 DELims=." %%G IN ('%PYTHON_HOME%/python.exe -c "import sys; print sys.version.split(' ')[0]"') DO SET PYTHON_MINOR=%%G
+    SET "PYTHON_VERSION=%PYTHON_MAJOR%%PYTHON_MINOR%"
+
+    IF NOT EXIST "%PYTHON_HOME%\Scripts\virtualenv.exe" GOTO err_handle_pythonvirtualenv
+
+    SET REQUIRMENTTXT=""
+    IF "%PYTHON_MAJOR%"=="2" SET REQUIRMENTTXT=requirements_py2.txt
+    IF "%PYTHON_MAJOR%"=="3" SET REQUIRMENTTXT=requirements_py3.txt
+    IF %REQUIRMENTTXT% == ""           GOTO err_handle_pythonversion
+    SET PATH=%PGDIR%;%PGDIR%\bin;%PATH%
+goto:EXIT
+
+
+:CLEAN_RELEASE
+    ECHO Calling Clean Release...
+    IF EXIST "%PGBUILDPATH%" rmdir /s /q "%PGBUILDPATH%" > nul
+    for /R "%WD%" %%f in (*.pyc) do DEL /q "%%f" > nul
+    IF EXIST "%WD%\pkg\win32\Output" rmdir /s /q "%WD%\pkg\win32\Output" > nul
+    DEL /q "%WD%\pkg\win32\installer.iss" > nul
+    CD %WD%
+GOTO:EOF
+
+:CREATE_VIRTUAL_ENV
+    ECHO Creating Virtual Enviroment...
+    IF NOT EXIST "%PGBUILDPATH%"  MKDIR "%PGBUILDPATH%"
+
+    CD "%PGBUILDPATH%"
+    "%PYTHON_HOME%\Scripts\virtualenv.exe" "%VIRTUALENV%"
+    IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
+
+    ECHO Activating Virtual Enviroment -  %PGBUILDPATH%\%VIRTUALENV%\Scripts\activate...
+    CALL "%PGBUILDPATH%\%VIRTUALENV%\Scripts\activate"
+    SET PATH=%PGDIR%\bin;%PATH%
+
+    ECHO Installing dependencies...
+    pip install -r "%WD%\%REQUIRMENTTXT%"
+    IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
+    REM This is required because windows only work with 2.6.1 version
+    pip  install psycopg2 -U
+    ECHO Virtual Enviroment created successfully.
+
+    ECHO Deactivating Virtual Enviroment - %PGBUILDPATH%\%VIRTUALENV%\Scripts\deactivate...
+    CALL "%PGBUILDPATH%\%VIRTUALENV%\Scripts\deactivate"
+
+    CD %WD%
+GOTO:EOF
+
+:CREATE_RUNTIME_ENV
+    ECHO Compiling source code...
+    MKDIR "%PGBUILDPATH%\runtime" > nul
+
+    REM --- Processing WEB ---
+    CD "%WD%"
+    CD web
+    IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
+    XCOPY /S /I /E /H /Y "%WD%\web" "%PGBUILDPATH%\web" > nul
+    IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
+
+    REM Clean up .pyc, pgadmin4.db, config_local.py
+    for /R "%PGBUILDPATH%\web" %%f in (*.pyc) do DEL /q "%%f"
+    DEL /s "%PGBUILDPATH%\web\pgadmin4.db" > nul
+    DEL /s "%PGBUILDPATH%\web\config_local.py" > nul
+    ECHO SERVER_MODE = False > "%PGBUILDPATH%\web\config_local.py"
+    ECHO HELP_PATH = '../../../docs/en_US/html/' >> "%PGBUILDPATH%\web\config_local.py"
+    ECHO MINIFY_HTML = False >> "%PGBUILDPATH%\web\config_local.py"
+    REM Compile doc folder
+    MKDIR "%PGBUILDPATH%\docs\en_US\html"
+    IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
+    REM compile docs - web
+    "%PGBUILDPATH%\%VIRTUALENV%\Scripts\sphinx-build.exe"   "%WD%\docs\en_US" "%PGBUILDPATH%\docs\en_US\html"
+
+    REM --- Processing RUNTIME ---
+    CD "%WD%"
+    CD runtime
+    IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
+
+    call "%VCVAR%" %ARCHITECTURE%
+    IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
+    ECHO Calling -  call "%VCVAR%" %ARCHITECTURE%
+
+    call "%QMAKE%"
+    IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
+
+    call "%VCNMAKE%" clean
+    IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
+
+    call "%VCNMAKE%"
+    IF ERRORLEVEL 1 GOTO ERR_HANDLER
+    REM Copy binary to Release Folder
+    copy "%WD%\runtime\release\pgAdmin4.exe" "%PGBUILDPATH%\runtime"
+    IF ERRORLEVEL 1 GOTO ERR_HANDLER
+
+    REM Copy QTP dependences
+    copy "%QTDIR%\bin\icudt54.dll"   "%PGBUILDPATH%\runtime"
+    IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
+    copy "%QTDIR%\bin\icuin54.dll"   "%PGBUILDPATH%\runtime"
+    IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
+    copy "%QTDIR%\bin\icuuc54.dll"   "%PGBUILDPATH%\runtime"
+    IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
+    copy "%QTDIR%\bin\Qt5Core.dll"   "%PGBUILDPATH%\runtime"
+    IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
+    copy "%QTDIR%\bin\Qt5Sql.dll"    "%PGBUILDPATH%\runtime"
+    IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
+    copy "%QTDIR%\bin\Qt5Gui.dll"    "%PGBUILDPATH%\runtime"
+    IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
+    copy "%QTDIR%\bin\Qt5Qml.dll"    "%PGBUILDPATH%\runtime"
+    IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
+    copy "%QTDIR%\bin\Qt5OpenGL.dll" "%PGBUILDPATH%\runtime"
+    IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
+    copy "%QTDIR%\bin\Qt5Quick.dll"  "%PGBUILDPATH%\runtime"
+    IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
+    copy "%QTDIR%\bin\Qt5Sensors.dll" "%PGBUILDPATH%\runtime"
+    IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
+    copy "%QTDIR%\bin\Qt5Widgets.dll" "%PGBUILDPATH%\runtime"
+    IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
+    copy "%QTDIR%\bin\Qt5WebKit.dll" "%PGBUILDPATH%\runtime"
+    IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
+    copy "%QTDIR%\bin\Qt5Network.dll" "%PGBUILDPATH%\runtime"
+    IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
+    copy "%QTDIR%\bin\Qt5Multimedia.dll" "%PGBUILDPATH%\runtime"
+    IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
+    copy "%QTDIR%\bin\Qt5WebChannel.dll" "%PGBUILDPATH%\runtime"
+    IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
+    copy "%QTDIR%\bin\Qt5Positioning.dll" "%PGBUILDPATH%\runtime"
+    IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
+    copy "%QTDIR%\bin\Qt5PrintSupport.dll" "%PGBUILDPATH%\runtime"
+    IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
+    copy "%QTDIR%\bin\Qt5WebKitWidgets.dll" "%PGBUILDPATH%\runtime"
+    IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
+    copy "%QTDIR%\bin\Qt5MultimediaWidgets.dll" "%PGBUILDPATH%\runtime"
+    IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
+    MKDIR "%PGBUILDPATH%\runtime\platforms"
+    IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
+
+    copy "%QTDIR%\plugins\platforms\qwindows.dll" "%PGBUILDPATH%\runtime\platforms" > nul
+    IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
+    ECHO [Paths] > "%PGBUILDPATH%\runtime\qt.conf"
+    ECHO Plugins=plugins >> "%PGBUILDPATH%\runtime\qt.conf"
+    ECHO Runtime source code built successfully.
+
+    CD %WD%
+GOTO:EOF
+
+:CREATE_PYTHON_ENV
+    copy %PYTHON_DLL% "%PGBUILDPATH%\runtime"  > nul
+    IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
+    XCOPY /S /I /E /H /Y "%PYTHON_HOME%\DLLs" "%PGBUILDPATH%\%VIRTUALENV%\DLLs" > nul
+    IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
+    XCOPY /S /I /E /H /Y "%PYTHON_HOME%\Lib" "%PGBUILDPATH%\%VIRTUALENV%\Lib" > nul
+    IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
+
+    CD %WD%
+GOTO:EOF
+
+:CREATE_INSTALLER
+    ECHO Preparing for creation of windows installer...
+    IF NOT EXIST "%TARGETINSTALLER%" MKDIR "%TARGETINSTALLER%"
+
+    copy "%WD%\pkg\win32\Resources\pgAdmin4.ico" "%PGBUILDPATH%"
+    IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
+    REM search and replace string from config.py and copy to config_local.py
+    CD "%WD%"
+    CD pkg
+    CD win32
+
+    echo copy "%WD%\pkg\win32\installer.iss.in" "%WD%\pkg\win32\installer.iss"
+    copy "%WD%\pkg\win32\installer.iss.in" "%WD%\pkg\win32\installer.iss"
+    IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
+
+    "%PYTHON_HOME%\python" -c "open(\"%WD%\pkg\win32\installer.iss\", \"r+\").write(open(\"%WD%\pkg\win32\installer.iss\", \"r\").read().replace(\"MYAPPNAME\",\"\"\" \"%APP_NAME%\" \"\"\"))"
+    IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
+
+    "%PYTHON_HOME%\python" -c "open(\"%WD%\pkg\win32\installer.iss\", \"r+\").write(open(\"%WD%\pkg\win32\installer.iss\", \"r\").read().replace(\"MYAPPVERSION\",\"\"\" \"%PGADMIN4_VERSION%\" \"\"\"))"
+    IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
+
+    "%PYTHON_HOME%\python" -c "open(\"%WD%\pkg\win32\installer.iss\", \"r+\").write(open(\"%WD%\pkg\win32\installer.iss\", \"r\").read().replace(\"MYAPPFULLVERSION\",\"\"\" \"%PGADMIN4_APP_VERSION%\" \"\"\"))"
+    IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
+
+    set ARCMODE=
+    IF "%ARCHITECTURE%"=="amd64" (
+        set ARCMODE="x64"
+    )
+    "%PYTHON_HOME%\python" -c "open(\"%WD%\pkg\win32\installer.iss\", \"r+\").write(open(\"%WD%\pkg\win32\installer.iss\", \"r\").read().replace(\"MYAPPARCHITECTURESMODE\",\"\"\" \"%ARCMODE%\" \"\"\"))"
+
+    CALL "%INNOTOOL%\ISCC.exe" /q "%WD%\pkg\win32\installer.iss"
+    IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
+    ECHO move "%WD%\pkg\win32\Output\Setup.exe" "%TARGETINSTALLER%\%INSTALLERNAME%"
+    MOVE "%WD%\pkg\win32\Output\SETup.exe" "%TARGETINSTALLER%\%INSTALLERNAME%"
+    IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
+
+    ECHO "Location - %TARGETINSTALLER%\%INSTALLERNAME%"
+    ECHO Installer generated successfully.
+    GOTO CLEAN_RELEASE
+    CD %WD%
+GOTO:EOF
+
+:CLEANUP_ENV
+    rd "%PGBUILDPATH%\%VIRTUALENV%\Include" /S /Q
+    rd "%PGBUILDPATH%\%VIRTUALENV%\Scripts" /S /Q
+    DEL /s "%PGBUILDPATH%\%VIRTUALENV%\pip-selfcheck.json"
+
+    ECHO Cleaned up private environment successfully.
+    CD %WD%
+GOTO:EOF
+
+:err_handle_inno
+    ECHO %INNOTOOL% does not exist
+    ECHO Please Install Innotool and SET INNOTOOL enviroment Variable.
+    ECHO SET "INNOTOOL=<PATH>"
+    exit /B 1
+goto EXIT
+
+:err_handle_visualstudio
+    ECHO %VCDIR% does not exist, or
+    ECHO %VCVAR% does not exist, or
+    ECHO %VCNMAKE% does not exist.
+    ECHO Please Install Microsoft Visual studio and SET the VCDIR enviroment Variable.
+    ECHO SET "VCDIR%=<PATH>"
+    ECHO SET "VCVAR%=<PATH>"
+    ECHO SET "VCNMAKE%=<PATH>"
+    exit /B 1
+goto EXIT
+
+:err_handle_python
+    ECHO %PYTHON_HOME% does not exist, or
+    ECHO PYTHON_VERSION is not SET, or
+    ECHO %PYTHON_DLL% does not exist.
+    ECHO Please install Python and SET the PYTHON_HOME enviroment Variable.
+    ECHO SET "PYTHON_VERSION=<VERSION NUMBER>"
+    ECHO SET "PYTHON_HOME=<PATH>"
+    ECHO SET "PYTHON_DLL=<PATH>"
+    exit /B 1
+goto EXIT
+
+:err_handle_qt
+    ECHO %QTDIR% does not exist.
+    ECHO Please Install QT SDK and SET the QTDIR enviroment variable.
+    ECHO SET "QTDIR=<PATH>"
+    exit /B 1
+goto EXIT
+
+:err_handle_qt_mismatch
+    ECHO %QTDIR%\..\%QT_MSVC_PATH%" does not match with your current Visual Studio, version %QT_MSVC_PATH%
+    ECHO Your current QT installation willraise a linking error with an MSVC version mismatch.
+    ECHO Please use a valid QT installation with a folder %QT_MSVC_PATH%. You can use the Qt Maintenance
+    ECHO Tool to add or remove compiler kits.
+    exit /B 1
+goto EXIT
+
+:err_handle_qt_compactissue
+    ECHO %QTDIR%" does support the current architecture selected %ARCHITECTURE%
+    ECHO Please use a valid QT installation with a folder %QT_MSVC_PATH%. You can use the Qt Maintenance
+    ECHO Tool to add or remove compiler kits.
+    exit /B 1
+goto EXIT
+
+:err_handle_pg
+    ECHO %PGDIR% does not exist.
+    ECHO Please Install Postgres and SET enviroment Variable
+    ECHO SET "PGDIR=<PATH>"
+    exit /B 1
+goto EXIT
+
+:err_handle_pythonversion
+    ECHO Python version supported Above 2.6, 2.xx and 3.xx only
+    exit /B 1
+goto EXIT
+
+:err_handle_pythonvirtualenv
+    ECHO Python virtualenv is missing @ location - %PYTHON_HOME%\Scripts\virtualenv.exe
+    exit /B 1
+goto EXIT
+
+:ERR_HANDLER
+    ECHO.
+    ECHO Aborting build!
+    CD %WD%
+    exit /B 1
+GOTO:EOF
+
+:USAGE
+    ECHO Invalid command line options....
+    ECHO Usage: "Make.bat <x86 | amd64 | clean>"
+    ECHO.
+    exit /B 1
+GOTO EXIT
+
+:EXIT
+     endlocal
+    exit /B 0
diff --git a/pkg/win32/README.txt b/pkg/win32/README.txt
new file mode 100755
index 0000000..9a1004f
--- /dev/null
+++ b/pkg/win32/README.txt
@@ -0,0 +1,46 @@
+﻿Building pgAdmin windows installer on windows
+=================================
+
+To generate a pgAdmin 4 installer for Windows bit, the following packages must be installed:
+
+1. Python installation
+  - Python 2.6 or above from https://www.python.org/
+
+2. QT installation
+  - Qt 4.6 through 5.5 from http://www.qt.io/
+
+3. PostgreSQL installation
+  - PostgreSQL 9.1 or above from http://www.postgresql.org/
+
+4. Inno Setup Installer
+   - 5.0 and above from http://www.jrsoftware.org/isdl.php
+
+5. Microsoft visual studio (2008 and above)
+
+Building: Depending upon the archicture of the OS(x86|amd64) set then environment variables.
+
+1. Set the PYTHON environment variable to the Python root installation directory, e.g. for x86
+
+   SET "PYTHON_HOME=C:\Python27"
+   SET "PYTHON_DLL=C:\Windows\System32\python27.dll"
+
+2. Set the QTDIR environment variable to the QT root installation directory, e.g. for x86
+
+   SET "QTDIR=C:\Qt\Qt5.5.1\5.5\msvc2013"
+
+3. Set the PGDIR environment variable to the PostgreSQL installation directory, e.g. for x86
+
+   SET "PGDIR=C:\Program Files\PostgreSQL\9.5"
+
+4. Set the Inno Setup Installer environment variable to the Inno root installation directory, e.g. for x86
+
+   SET "INNOTOOL=C:\Program Files\Inno Setup 5"
+
+5. Set the Miscrosoft Visual studio environment variable to the Visual studio root installation directory, e.g. for x86
+
+   SET "VCDIR=C:\Program Files\Microsoft Visual Studio 12.0\VC"
+
+6. To build, go to pgAdmin4 source root directory and execute "Make.bat x86|amd64". Based on x86|amd64, this will
+   create the python virtual environment and install all the required python modules mentioned in the
+   requirements file using pip, build the runtime code and finally create the windows installer x86|amd64 in ./dist directory
+
diff --git a/pkg/win32/Resources/SplashScreen.bmp b/pkg/win32/Resources/SplashScreen.bmp
new file mode 100755
index 0000000000000000000000000000000000000000..c2407307ef3ba7d4093c7a0762cd94cbc84316cc
GIT binary patch
diff --git a/pkg/win32/Resources/license.rtf b/pkg/win32/Resources/license.rtf
new file mode 100755
index 0000000000000000000000000000000000000000..40555108fa0575040cd3d8bb06da301fea2dd2a6
GIT binary patch
diff --git a/pkg/win32/Resources/pgAdmin4.ico b/pkg/win32/Resources/pgAdmin4.ico
new file mode 100755
index 0000000000000000000000000000000000000000..3fcebafdc9c16dedaf800066f84a3fb91a226ec1
GIT binary patch
diff --git a/pkg/win32/installer.iss.in b/pkg/win32/installer.iss.in
new file mode 100755
index 0000000..fdace92
--- /dev/null
+++ b/pkg/win32/installer.iss.in
@@ -0,0 +1,115 @@
+#define MyAppName MYAPPNAME
+#define MyAppVersion MYAPPVERSION
+#define MyAppPublisher "The pgAdmin Development Team"
+#define MyAppURL "www.pgadmin.org"
+#define MyAppExeName "pgAdmin4.exe"
+#define MyAppID "C14F64E7-DCB9-4DE1-8560-16F08FCFF64E"
+#define MyAppFullVersion MYAPPFULLVERSION
+#define MyAppArchitecturesMode MYAPPARCHITECTURESMODE
+[Setup]
+AppId={#MyAppName}{#MyAppVersion}
+AppName={#MyAppName}
+AppVersion={#MyAppFullVersion}
+AppPublisher={#MyAppPublisher}
+AppPublisherURL={#MyAppURL}
+AppSupportURL={#MyAppURL}
+AppUpdatesURL={#MyAppURL}
+DefaultDirName={pf}\{#MyAppName}\{#MyAppVersion}
+DisableWelcomePage=no
+DisableProgramGroupPage=yes
+LicenseFile=Resources\license.rtf
+OutputBaseFilename=setup
+SetupIconFile=Resources\pgAdmin4.ico
+Compression=lzma
+SolidCompression=yes
+PrivilegesRequired=admin
+ChangesEnvironment=yes
+;UninstallFilesDir={app}\{#MyAppVersion}
+ArchitecturesInstallIn64BitMode={#MyAppArchitecturesMode}
+
+[Languages]
+Name: "english"; MessagesFile: "compiler:Default.isl"
+
+[Icons]
+Name: {group}\{#MyAppName}; Filename: {app}\runtime\{#MyAppExeName}; IconFilename: {app}\pgAdmin4.ico; WorkingDir: {app}; Comment: "{#MyAppName}";
+Name: {commondesktop}\{#MyAppName}; Filename: {app}\runtime\{#MyAppExeName}; IconFilename: {app}\pgAdmin4.ico; WorkingDir: {app}; Comment: "{#MyAppName}";
+
+[Files]
+Source: "Resources\SplashScreen.bmp"; DestDir: {tmp}; Flags: dontcopy
+Source: "..\..\win-build\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs;
+
+[Run]
+Filename: "{app}\runtime\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: runascurrentuser nowait postinstall skipifsilent
+
+[CustomMessages]
+english.NewerVersionExists=A newer version of {#MyAppName}
+
+[Registry]
+Root: HKLM; Subkey: "Software\{#MyAppName}\{#MyAppVersion}"; Flags: uninsdeletekeyifempty
+Root: HKLM; Subkey: "Software\{#MyAppName}\{#MyAppVersion}"; Flags: uninsdeletekey
+Root: HKLM; Subkey: "Software\{#MyAppName}\{#MyAppVersion}"; ValueType: string; ValueName: "InstallPath"; ValueData: "{app}"
+Root: HKLM; Subkey: "Software\{#MyAppName}\{#MyAppVersion}"; ValueType: string; ValueName: "Version"; ValueData: "{#MyAppFullVersion}"
+
+[Code]
+var
+  // Required for Splash Screen.
+  Splash  : TSetupForm;
+
+procedure CurStepChanged(CurStep: TSetupStep);
+var
+ value : string;
+ begin
+   if CurStep = ssInstall then begin
+     value := ExpandConstant('{app}') + '\ve_python\Lib\site-packages' + ';' +
+     ExpandConstant('{app}') + '\ve_python\Lib' + ';' +
+     ExpandConstant('{app}') + '\ve_python\Lib\lib-tk' + ';' +
+     ExpandConstant('{app}') + '\ve_python\DLLs';
+     RegWriteStringValue(HKEY_CURRENT_USER,'Software\pgAdmin Development Team\pgAdmin 4', 'PythonPath', value);
+ end;
+end;
+
+// find current version before installation
+function InitializeSetup: Boolean;
+var
+  Version: String;
+  BitmapImage1 : TBitmapImage;
+begin
+  Splash := CreateCustomForm;
+  Splash.BorderStyle := bsNone;
+  BitmapImage1 := TBitmapImage.Create(Splash);
+  BitmapImage1.AutoSize := True;
+  BitmapImage1.Align := alClient;
+  BitmapImage1.Left := 0;
+  BitmapImage1.Top := 0;
+  BitmapImage1.stretch := True;
+  BitmapImage1.Parent := Splash;
+  ExtractTemporaryFile('SplashScreen.bmp');
+  BitmapImage1.Bitmap.LoadFromFile(ExpandConstant('{tmp}') + '\SplashScreen.bmp');
+  Splash.Width := BitmapImage1.Width;
+  Splash.Height := BitmapImage1.Height;
+  Splash.Center;
+  Splash.Show;
+  BitmapImage1.Refresh;
+  Sleep(3000);
+
+  if RegValueExists(HKEY_LOCAL_MACHINE,'Software\{#MyAppName}\{#MyAppVersion}', 'Version') then
+    begin
+      RegQueryStringValue(HKEY_LOCAL_MACHINE,'Software\{#MyAppName}\{#MyAppVersion}', 'Version', Version);
+      if Version > '{#MyAppFullVersion}' then
+        begin
+          MsgBox(ExpandConstant('{cm:NewerVersionExists}' + '(v' + Version + ') is already installed' ), mbInformation, MB_OK);
+          Result := False;
+        end
+      else
+        begin
+          Result := True;
+        end
+    end
+  else
+    begin
+      Result := True;
+    end
+
+  Splash.Close;
+end;
+// End of program
\ No newline at end of file
