Logging batch output to text file?

Discussion in 'Scripting' started by lysy.lbn, Nov 21, 2012.

  1. lysy.lbn

    lysy.lbn MDL Member

    Apr 20, 2011
    125
    65
    10
    Hello, how can I save whole content of console window without adding ">>savetothisfile.txt" at end of every command line?
    Is there any method to add just one line at end to save whole cmd window output?
     
  2. Alphawaves

    Alphawaves Super Moderator/Developer
    Staff Member

    Aug 11, 2008
    6,222
    22,281
    210
    #2 Alphawaves, Nov 21, 2012
    Last edited by a moderator: Apr 20, 2017
    How about:

    Code:
    doskey /history > C:\saved.txt
    :eek:
     
  3. lysy.lbn

    lysy.lbn MDL Member

    Apr 20, 2011
    125
    65
    10
    Saving empty file
     
  4. Alphawaves

    Alphawaves Super Moderator/Developer
    Staff Member

    Aug 11, 2008
    6,222
    22,281
    210
    #4 Alphawaves, Nov 21, 2012
    Last edited by a moderator: Apr 20, 2017
    It should display any history from current cmd, can you show me what you are doing ? ;)

    EDIT: I don't think this is the answer your looking for..

    Another is add this before any command:

    Code:
    copy con c:\save.txt
    not enter your content..

    This may or may not be wot your looking for :)
     
  5. lysy.lbn

    lysy.lbn MDL Member

    Apr 20, 2011
    125
    65
    10
    Still.. no luck

    I'm testing it with few echo messages in CMD
     
  6. RaymondTH

    RaymondTH MDL Member

    Apr 23, 2012
    103
    29
    10
    AFIK this isn't possible unless you call the first batch file from a command adding the ">>savetothisfile.txt"
     
  7. Michaela Joy

    Michaela Joy MDL Crazy Lady

    Jul 26, 2012
    4,071
    4,651
    150
    do you have @echo off as the first command in your batch file?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...