Martin_laursen 0 Newbie Poster

Hello, i have a problem with a batch file i'm writing.

@echo off
title TEST FORUM
:refresh
cls
echo É»
echo º                       º
echo º     Welcome to my     º
echo º      TEST FORUM       º
echo º                       º
echo ȼ
echo.
call database.bat
echo.
echo      ÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
echo      ³1: Write new message
echo      ³2: Refresh          
echo      ³
echo.
set choice=
set /p choice=      Type here:
if not '%choice%'=='' set choice %choice:~0,1%
if '%choice%'=='1' goto writemessage1
if '%choice%'=='2' goto refresh
goto refresh
:writemessage1
cls
echo when writing a new message
echo you may not:
echo 1. Use ' ' (space)
echo use '_' instead, or put
echo "" around your words.
echo 2. put " at the very start.
echo 3. Write more than '50' 
echo letters and signs(!?_ etc)
echo without making a new line
echo break.
echo.
echo Type "finish" to end.
echo Type "cancel" to end without saving.
echo.
echo Answer "yes" or "no".
set choice=
set /p choice=OK? 
if not '%choice%'=='' set choice %choice:~0,3%
if '%choice%'=='yes' goto writemessage2
if '%choice%'=='no' goto refresh
:writemessage2
echo echo ÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ >> database.bat
cls
echo Text preview:
:writemessage3
set writemessage=
set /p writemessage=
if not '%writemessage%'=='' set writemessage %writemessage:~0,50%
if '%writemessage%'=='finish' goto finish
if '%writemessage%'=='' echo echo ³ >> database.bat
if '%writemessage%'=='%writemessage%' echo echo ³%writemessage% >> database.bat
goto writemessage3
:finish
echo echo ³ >> database.bat
goto refresh

Technically it works, but if two are writing at the same time the two messages would mix. so i tried this:

@echo off
set data=">> database.bat"
:refresh
cls
echo É»
echo º                       º
echo º     Welcome to my     º
echo º      TEST FORUM       º
echo º                       º
echo ȼ
echo.
call database.bat
echo.
echo      ÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
echo      ³1: Write new message
echo      ³2: Refresh          
echo      ³
echo.
set choice=
set /p choice=      Type here:
if not '%choice%'=='' set choice %choice:~0,1%
if '%choice%'=='1' goto writemessage1
if '%choice%'=='2' goto refresh
goto refresh
:writemessage1
cls
echo when writing a new message
echo you may not:
echo 1. Use ' ' (space)
echo use '_' instead, or put
echo "" around your words.
echo 2. put " at the very start.
echo 3. Write more than '50' 
echo letters and signs(!?_ etc)
echo without making a new line
echo break.
echo.
echo Type "finish" to end.
echo Type "cancel" to end without saving.
echo.
echo Answer "yes" or "no".
set choice=
set /p choice=OK? 
if not '%choice%'=='' set choice %choice:~0,3%
if '%choice%'=='yes' goto writemessage2
if '%choice%'=='no' goto refresh
if '%choice%'=='Yes' goto writemessage2
if '%choice%'=='No' goto refresh
if '%choice%'=='YES' goto writemessage2
if '%choice%'=='NO' goto refresh
goto writemessage1
:writemessage2
echo echo echo ÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ %data% >> chat1data.bat
cls
echo Text preview:
:writemessage3
set writemessage=
set /p writemessage=
if not '%writemessage%'=='' set writemessage %writemessage:~0,50%
if '%writemessage%'=='finish' goto finish
if '%writemessage%'=='cancel' goto cancel
if '%writemessage%'=='' echo echo ³ %data% >> chat1data.bat
if '%writemessage%'=='%writemessage%' echo echo echo ³%writemessage% %data% >> chat1data.bat
goto writemessage3
:finish
echo echo echo ³ %data% >> chat1data.bat
sed -e s/"//g chat1data.bat
call chat1data.bat
:cancel
del chat1data.bat
goto refresh

It didn't work, i believe the fault is in the sed code but i dont know how to fix it. please help.