pushd %~dp0
call ContactsOdata\ContactsOdata.deploy.cmd /y
call PromoEngine\IPosWebApi.deploy.cmd /y
call PaymentTerminalOdata\PaymentTerminalOdata.deploy.cmd /y

@echo off
set search_for=IIS Web Application Name
set "xml_file_contactsOdata=%~dp0\ContactsOdata\ContactsOdata.SetParameters.xml"

for /f "skip=1 tokens=8,9,10 delims=;= " %%a in ('find """%search_for%""" "%xml_file_contactsOdata%"') do (

    set contactsOdata=%%a %%b %%c
)
echo value: %contactsOdata%

set "xml_file_promoEngine=%~dp0\PromoEngine\IPosWebApi.SetParameters.xml"

for /f "skip=1 tokens=8,9,10 delims=;= " %%a in ('find """%search_for%""" "%xml_file_promoEngine%"') do (

    set promoEngine=%%a %%b %%c
)
echo value: %promoEngine%

set "xml_file_payment=%~dp0\PaymentTerminalOdata\PaymentTerminalOdata.SetParameters.xml"

for /f "skip=1 tokens=8,9,10 delims=;= " %%a in ('find """%search_for%""" "%xml_file_payment%"') do (

    set payment=%%a %%b %%c
)
echo value: %payment%

call cd %windir%\system32\inetsrv
call appcmd set vdir /vdir.name:%contactsOdata%/ /userName:IposService /password:BBCTech06
call appcmd set vdir /vdir.name:%promoEngine%/ /userName:IposService /password:BBCTech06
call appcmd set vdir /vdir.name:%payment%/ /userName:IposService /password:BBCTech06

pause