echo off
setlocal

tasklist /FI "IMAGENAME eq Bridge.exe" 2>NUL | find /I /N "Bridge.exe">NUL
if "%ERRORLEVEL%"=="0" (
  echo The Bridge is already running.
  goto running
)

pushd %~dp0
echo Building the Bridge...
call BuildWCFTestService.cmd
popd

if '%BridgeResourceFolder%' == '' (
   set _bridgeResourceFolder=..\..\Bridge\Resources
) else (
   set _bridgeResourceFolder=%BridgeResourceFolder%
)

pushd %~dp0..\..\..\..\bin\wcf\tools\Bridge
echo Invoking Bridge.exe with arguments: /BridgeResourceFolder:%_bridgeResourceFolder% %*
start /MIN Bridge.exe /BridgeResourceFolder:%_bridgeResourceFolder% %*
popd

:running
exit /b


Add script to conditionally start Bridge
Add script to conditionally start Bridge

This CMD is meant to be called only on Windows machines
that need to ensure the Bridge is running without the
overhead checking whether it needs to be built.

It is intended to be invoked in automated Windows test
runs that require the Bridge.
