Page 1 of 1

Batch output question

Posted: 30 Jun 2011 02:39
by Jayrome
I currently have a batch file which I run to output URLS into a text file seperated by the date as you can see below. Everytime I run the batch file to add new info into the output file it adds it to the bottom of the page. Which command will add it to the top of the page so i'm not having to scroll all the way to the bottom for the latest information?

Thanks :)

———————————
Thu 30/06/2011
———————————
URL
URL
URL
URL
———————————
Thu 30/06/2011
———————————
URL1
URL1
URL1
———————————
Thu 30/06/2011
———————————

New URL
New URL

Re: Batch output question

Posted: 30 Jun 2011 07:41
by Acy Forsythe
There isn't a command, but something like this would work...

Code: Select all

@echo off

... Run your commands as normal from your script >> NewOutputFile.txt

For /F "tokens=* delims=" %%a IN (OldOutputFile.txt) DO echo %%a >> NewOutputFile.txt

DEL /Q OldOutputFile.txt
REN NewOutputFile.txt OldOutputFile.Txt


All your new stuff goes to the top of NewOutput file then all the stuff from OldOutputFile goes in after it.

Re: Batch output question

Posted: 30 Jun 2011 11:19
by nitt
Acy Forsythe wrote:There isn't a command, but something like this would work...

Code: Select all

@echo off

... Run your commands as normal from your script >> NewOutputFile.txt

For /F "tokens=* delims=" %%a IN (OldOutputFile.txt) DO echo %%a >> NewOutputFile.txt

DEL /Q OldOutputFile.txt
REN NewOutputFile.txt OldOutputFile.Txt


All your new stuff goes to the top of NewOutput file then all the stuff from OldOutputFile goes in after it.


If all we are doing is adding something to the top, all we have to do is

Code: Select all

@echo off
echo newinformation > tmp.txt
type original.txt >> tmp.txt
echo y|move "tmp.txt", "original.txt"