Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Batch Chat Room Script

107 views
Skip to first unread message

Lashnjo

unread,
Jan 12, 2008, 7:46:24 PM1/12/08
to
I'm attempting to create a script that will allow users to chat on the
command line.

@echo off
:Loop
set /p input=Input:
echo User: %input% > Hi.txt
type Hi.txt
goto Loop

That is what I have so far.
What I need is the ability to not replace the text file every time
something is input but to just to add the input to the text file,
leaving all the other past inputs.
The computers that will be used are Windows XP.
Thanks!

Ted Davis

unread,
Jan 12, 2008, 8:41:56 PM1/12/08
to

echo User: %input% > Hi.txt
replaces the file
echo User: %input% >> Hi.txt
appends to the file - at some point, you have to delete it, probably at
the start or end of the program.


--

T.E.D. (tda...@mst.edu) MST (Missouri University of Science and Technology)
used to be UMR (University of Missouri - Rolla).

billious

unread,
Jan 12, 2008, 8:51:33 PM1/12/08
to

"Lashnjo" <pardue....@gmail.com> wrote in message
news:64248dc7-f8ed-4544...@s19g2000prg.googlegroups.com...

Replace ">" in the echo.... with ">>".

>> APPENDS to a file, > creates the file anew.

Meanwhile, you could consider changing "user" to %username%

And you might also be better off in alt.msdos.batch.nt since you're using
XP. The command-set for NT and later is substantially enhanced over DOS/9x
which has become the target for this group.


Lashnjo

unread,
Jan 12, 2008, 10:28:15 PM1/12/08
to
On Jan 12, 8:51 pm, "billious" <billious_1...@hotmail.com> wrote:
> "Lashnjo" <pardue.step...@gmail.com> wrote in message

Ha, thank you got it working nice now. The %username% was a great
suggestion. This is the code now.
@echo off
set /p username=Please type your username
:Loop
set /p input=:
echo %username%: %input% >> Hi.txt
type hi.txt
goto Loop

I'll check out .nt also thank you!

0 new messages