Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: combining text and output into 1 logfile  (Read 3693 times)

0 Members and 1 Guest are viewing this topic.

naarts

  • Guest
combining text and output into 1 logfile
« on: March 08, 2006, 12:32:28 AM »
For creating a log file i have to combine text and the result of the copy command in 1 text line in a new file.

now:
echo %varname% >> logfile
copy x Y >> logfile

this result in two lines in the logfile
varname
1 files copied


is it possible to connect it to get the following result:

varname ; 1 files copied

1 line in the logfile

bdetchevery

  • Guest
Re: combining text and output into 1 logfile
« Reply #1 on: March 09, 2006, 07:52:46 AM »
Most versions of DOS do not have an echo command that will supress newline. This means that any echo command will automatically move to the next line.

You can create your own version of echo that supresses newline with the following command

ECHO ,8P_,FPZ0U]0U[,B0EWP_[SCYQ2M@I~E5@@O!A>%temp%.\echoit.com

This creates a quick assembly file called echoit.com in your %temp% directory.

Then change your commands that use echo command to use echoit instead. So something like

@ECHO OFF
ECHO ,8P_,FPZ0U]0U[,B0EWP_[SCYQ2M@I~E5@@O!A>%temp%.\echoit.com
%temp%\echoit %varname% ;>> logfile
copy x Y >> logfile
del %temp%.\echoit.com ;Delete the program when we are done with it.

You don't have to create and delete the file each time. You could just make it once but then your batch would be specific to the one machine that has echoit.com on it.

naarts

  • Guest
Re: combining text and output into 1 logfile
« Reply #2 on: March 09, 2006, 11:38:30 PM »
Thanks, it works fine