1

Well, I have this program that I run with the help of batch. Its a PHP script that is ran by an EXE file. How can I have it that while the program is running, the output is automatically sent to a file, say log.txt, and have the output simultaneously shown on screen?

I tried something like program.exe >> log.txt, but that didnt show output on the screen.

Galilsnap
  • 366
  • 2
  • 6
  • 11
  • 1
    Related: [Looking for a windows equivalent of the unix tail command](http://stackoverflow.com/questions/187587/looking-for-a-windows-equivalent-of-the-unix-tail-command), but no native solutions unless you use PowerShell. And there [doesn't appear to be a native `tee` command either](http://www.halfbakery.com/idea/Useful_20command_2fprompt_20window). – moinudin Jan 01 '11 at 09:25

2 Answers2

1

By 'show output on the screen' do you mean updating the file contents on an already opened screen/console window.

If yes, you can use the following command

tail -f log.txt

Please note that 'tail' is not available with base installation of windows, but you can download it (free). look for unixUtils for windows.

Vikram.exe
  • 4,387
  • 3
  • 27
  • 38
1

If you want to do it only with windows commands may be you should try something like this:

program.exe > %temp%\temp.log
type %temp%\temp.log
type >>  log.txt
@del %temp%\temp.log /S /Q

there is no tail equivalent in windows commands.

npocmaka
  • 51,748
  • 17
  • 123
  • 166