Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Batch File Q

  • 30-07-2007 04:12PM
    #1
    Registered Users, Registered Users 2 Posts: 490 ✭✭


    Hi Guys,
    I have a small batch file thats spits a load of output onto the screen, its somethign like this....

    @echo off
    call makebuilda.bat
    call makebuildb.bat
    call copybuild.bat
    pause

    In order to get it to write this output to a file I changed it to
    @echo off
    call makebuilda.bat >file.txt
    call makebuildb.bat >>file.txt
    call copybuild.bat >>file.txt
    pause

    Good news is it more or less works,
    Bad news is it no longer displays the output on the command window

    How do I get both to work?


Comments

  • Closed Accounts Posts: 68 ✭✭nuada


    remove @echo off


  • Registered Users, Registered Users 2 Posts: 490 ✭✭delop


    nuada wrote:
    remove @echo off

    Thats not suitable because it outputs everything including variables etc ...


  • Registered Users, Registered Users 2 Posts: 1,379 ✭✭✭Shane O' Malley


    Can you run both, one with the redirection and one without.

    Doubles the work, but may suit.

    Other than that, all i can think of is a redirect within the batch file you are calling to echo to CON


  • Moderators, Recreation & Hobbies Moderators, Science, Health & Environment Moderators, Technology & Internet Moderators Posts: 96,090 Mod ✭✭✭✭Capt'n Midnight


    Not what you want but..
    [php]
    @echo off
    call makebuilda.bat >file.txt
    type file.txt
    call makebuildb.bat >>file.txt
    type file.txt
    call copybuild.bat >>file.txt
    type file.txt
    pause[/php]

    or notepad file.txt and re-open

    But yeah it would be handy having an app that could input a stream , display the live stream and pipe it to the file too.
    I'm sure you could do it with SED but there must be an easier way


  • Registered Users, Registered Users 2, Paid Member Posts: 21,534 ✭✭✭✭Alun


    But yeah it would be handy having an app that could input a stream , display the live stream and pipe it to the file too.

    Unix's tee command does exactly that.

    Win32 versions of that and a load of others available at http://gnuwin32.sourceforge.net/summary.html Installing these means installing loads of support stuff such as libraries as well, so you may prefer a standalone versions of that one program. If you Google tee.exe you'll find loads .. here's one http://www.csc.calpoly.edu/~bfriesen/software/files/tee32.zip


  • Advertisement
Advertisement