Flush memory from batch file

Snavarro January 27, 2009 at 13:28:58
Specs: Windows 2000
I have a batch file that executes some sql commands against a database. This output is directed to a file. Is there a way to force the batch file to flush each statement to the output file, instead of waiting until the batch file has completed execution before it writes all the data out? I have been unable to find this answer anywhere.

See More: Flush memory from batch file

Report •

January 27, 2009 at 16:24:23
All output should be flushed when the SQL commands finish executing. Try splitting the SQL portion into smaller chunks.

Report •

January 28, 2009 at 08:22:57
Nothing seems to print until after the batch script has completed execution. I have several 'echo "blah blah" >> out.txt' statements before the sql execution. Even these are not printed to the file until the script has completed all execution of commands. The 'out.txt' file isnt even created until the script is completed either, which is why I was interested in a "flush"-like capability.

Report •

January 28, 2009 at 11:23:28
I had responded. I'm not sure where it went, so here it is again:

That's interesting. I'd assume it's caused by an over aggressive write cache scheme.

You could try a third party program like Sync.

Alternatively, you could try working around it by spawning a copy of CMD per line of output, like so:

cmd /c echo Hello World >> out.txt
cmd /c echo Flush me to disk >> out.txt

Report •

Related Solutions

January 28, 2009 at 12:33:09
Thanks - it is now working for me. I really appreciate your help! Have a great day!

Report •

Ask Question