	
@echo off

Rem cls
:start
ECHO What do you want to do?
ECHO 1. Click 1 to setup a Server machine
ECHO 2. Click 2 to setup a Client Machine
ECHO 3. Click 3 to setup a Student Terminal
ECHO 4. Click 4 to cancel and quit
set /p choice=Type the number to proceed to setup.
rem if not '%choice%'=='' set choice=%choice:~0;1% ( don`t use this command, because it takes only first digit in the case you type more digits. After that for example choice 23455666 is choice 2 and you get "bye"
if '%choice%'=='' ECHO "%choice%" is not valid please try again
if '%choice%'=='1' goto server
if '%choice%'=='2' goto client
if '%choice%'=='3' goto terminal
if '%choice%'=='4' goto quit
ECHO.
goto start
:server
ECHO Starting installing and setup the server....
ECHO -------------------------------------------------
ECHO First take a note of your ip number shown above.
ECHO You will need this to install the clients and terminals:
Rem for /f "delims=[] tokens=2" %%a in ('ping -4 -n 1 %ComputerName% ^| findstr [') do set NetworkIP=%%a
Rem echo Network IP:
@echo off
FOR /F "tokens=4 delims= " %%i in ('route print ^| find " 0.0.0.0"') do set localIp=%%i
echo Your IP Address is: %localIp%
ECHO ------------------------------------------------------
ECHO  %localIp%
ECHO ------------------------------------------------------
pause
call setupFiles.bat
ECHO ok
ECHO -------------------------------------------------------
echo localhost>C:\Librography\ipserver
Rem echo localhost>C:\Librography\ipserver
call setupJava.bat

Rem :start
Rem ECHO What Batabase type do you want to use?
Rem ECHO 1. MySql
Rem ECHO 2. Postgresql
Rem set /p choice=Type the number to proceed to setup.
Rem if '%choice%'=='' ECHO "%choice%" is not valid please try again
Rem if '%choice%'=='1' goto mysql
Rem if '%choice%'=='2' goto postgres
Rem ECHO.
Rem goto start
Rem :mysql
Rem call setupMysql.bat
Rem :postgres
call setupPostgres.bat

ECHO 
goto end
:client
ECHO Starting installing and setup the client....
ECHO -------------------------------------------------
call setupFiles.bat
Rem setup server ip
echo Enter the server ip : 
set /p ipserver=
echo The server ip is  %localIp%
echo %localIp%>C:\Librography\ipserver
call setupJava.bat
ECHO BYE
goto end
:terminal
ECHO TEST
goto end
:quit
ECHO Bye
goto end
:end
pause
Rem exit