[SOLVED]Writing created text to a .txt file

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
MykeGregory
Posts: 2
Joined: 01 Jul 2013 05:28

[SOLVED]Writing created text to a .txt file

#1 Post by MykeGregory » 01 Jul 2013 05:47

Basicly, I'm trying to take the text written by an application into a batch file, to be written into a .txt file..

Let me break it down.
I play a game that uses a batch code to open the game.
The code is;

Code: Select all

title AssaultCube
cls
bin_win32\ac_client.exe --init %1 %2 %3 %4 %5
pause

Simple: This batch file opens the Game/Application.

When you play the game it writes things likes kills/suicides etc to the batch file.
And when you close the game it looks like this...
Image

I want ^^ That ^^ Text to be written to a seperate .txt file.
I have tried things like " >> ac_log.txt" But theres no way i'v found to write ALL the text to a different file.
Is there anyway to do this? Any code i can just slip in?

EDIT:
I have written this little thing to give an option to do so..

Code: Select all

bin_win32\ac_client.exe --init %1 %2 %3 %4 %5
echo =====================================
echo 1 - Save this text
echo 2 - Exit
set /p input=
if %input%==1 goto savetext
if %input%==2 goto exit

:savetext
(CODE HERE TO WRITE TEXT TO .TXT FILE)
Last edited by MykeGregory on 02 Jul 2013 08:04, edited 1 time in total.

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Writing created text to a .txt file

#2 Post by foxidrive » 01 Jul 2013 15:55

Try this:

Code: Select all

call batchfile >file.log 2>&1

MykeGregory
Posts: 2
Joined: 01 Jul 2013 05:28

Re: Writing created text to a .txt file

#3 Post by MykeGregory » 02 Jul 2013 08:02

Code: Select all

title AssaultCube
cls
bin_win32\ac_client.exe --init %1 %2 %3 %4 %5 >> AC_Log.txt
pause
echo ======
echo 1 - Save this session text
echo 2 - Back to Main Menu
set /p input=
if %input%==1 goto savetext
if %input%==2 goto delmain
:delmain
del ac_log.txt
goto main


Acctually found this code to work for what i want.
Thanks for the reply though.

Squashman
Expert
Posts: 4488
Joined: 23 Dec 2011 13:59

Re: Writing created text to a .txt file

#4 Post by Squashman » 02 Jul 2013 12:59

MykeGregory wrote:

Code: Select all

title AssaultCube
cls
bin_win32\ac_client.exe --init %1 %2 %3 %4 %5 >> AC_Log.txt
pause
echo ======
echo 1 - Save this session text
echo 2 - Back to Main Menu
set /p input=
if %input%==1 goto savetext
if %input%==2 goto delmain
:delmain
del ac_log.txt
goto main


Acctually found this code to work for what i want.
Thanks for the reply though.

You said you tried that in your first post.

Post Reply