@ECHO off
blat -install smtp.mrcuk.mr-carpet.co.uk dbupdaterelease@mr-carpet.co.uk
goto menu

:menu
cls
ECHO *****************************************************************************
ECHO **                            DB Updates Release                           **
ECHO *****************************************************************************
echo.
echo.
echo                            Make your selection below:
echo.
echo			[1]	Make updates available to all MrC Hosts
echo.
echo			[2]	Make "SW2010" updates available to all MrC Hosts
echo.
echo			[3]	Stop updates being released
echo.
echo			[4]	Check update release status
echo.
echo			[5]	Exit
echo.
echo.
c:\MrC\choice.com /C:12345
if errorlevel=5 goto exit
if errorlevel=4 goto status
if errorlevel=3 goto stopupdates
if errorlevel=2 goto SW2010updates
if errorlevel=1 goto releaseupdates

:releaseupdates
echo New Updates Released by %USERNAME%  - %DATE% - %TIME% (MRCHOSTs will receive update during overnight reboot) >> \\SU3200\DBUpdateRelease$\MrCDBReleaseLog.txt

ren \\mrcdb\mrchostswdata$\UpdatesAvailable.flg_ UpdatesAvailable.flg
at \\mrcdb 04:00 c:\MrC\StopDBUpdates.bat
cls
echo.
echo FYI - Update release will automatically be turned off at 04:00 tomorrow !!
echo.
echo.
at \\mrcdb
echo.
echo.
sleep 10
goto status


:SW2010updates
echo New SW2010 Updates Released by %USERNAME%  - %DATE% - %TIME% (MRCHOSTs will receive update during overnight reboot) >> \\SU3200\DBUpdateRelease$\MrCDBReleaseLog.txt

ren \\mrcdb\mrchostswdata$\SW2010UpdatesAvailable.flg_ SW2010UpdatesAvailable.flg
at \\mrcdb 04:00 c:\MrC\StopDBUpdates.bat
cls
echo.
echo FYI - SW2010 Update release will automatically be turned off at 04:00 tomorrow !!
echo.
echo.
at \\mrcdb
echo.
echo.
sleep 10
goto status


:stopupdates
echo Updates stopped by %USERNAME%  - %DATE% - %TIME% (MRCHOSTs will not receive updates until manually released) >> \\SU3200\DBUpdateRelease$\MrCDBReleaseLog.txt

ren \\mrcdb\mrchostswdata$\UpdatesAvailable.flg UpdatesAvailable.flg_
ren \\mrcdb\mrchostswdata$\SW2010UpdatesAvailable.flg SW2010UpdatesAvailable.flg_
cls
echo.
echo FYI - Update will not be released to MRCHOST's unless manually set !!
echo.
echo.
echo.
sleep 5
goto status

:status
cls
blat \\SU3200\DBUpdateRelease$\MrCDBReleaseLog.txt -to davidguyan@mr-carpet.co.uk -cc peterguyan@mr-carpet.co.uk -subject "New MrC DB Status Update"
:blat \\SU3200\DBUpdateRelease$\MrCDBReleaseLog.txt -to peterguyan@mr-carpet.co.uk -subject "TEST ONLY: New MrC DB Status Update"
cls
if exist \\mrcdb\mrchostswdata$\UpdatesAvailable.flg_ echo Updates are NOT currently set to be released
if exist \\mrcdb\mrchostswdata$\UpdatesAvailable.flg echo Updates ARE currently set to be released
echo.
if exist \\mrcdb\mrchostswdata$\SW2010UpdatesAvailable.flg_ echo SW2010 Updates are NOT currently set to be released
if exist \\mrcdb\mrchostswdata$\SW2010UpdatesAvailable.flg echo SW2010 Updates ARE currently set to be released
sleep 10s
goto menu

:NOTALLOWED
cls
echo Not authorised to run from this PC !!!!!
echo.
echo.
sleep 10

:exit
exit