Cmd.exe - save all output/history?


  1. Posts : 4
    Windows 7 64bit
       #1

    Cmd.exe - save all output/history?


    I missed some cmd.exe output today and I would really have liked to know what that was. I know it wasn't malware, but that's not the point :)

    Is there a way to make cmd.exe copy all it's output to a text file automatically or something similar that I could use to check back on what my system did there?

    I already checked google, it said there's "no way". Only with powershell, but that's not exactly what I want because I don't really do a lot of that stuff, but I'd come back to it, if nobody knows anything else.
      My Computer


  2. Posts : 797
    Windows 7 Ultimate (x64)
       #2

    Do you want to copy output of a particular command or series of commands or do you want to make a global and permanent change, so that absolutely everything showing up in the command prompt window is copied?

    In the former case, you can just use the "redirect" command. For example "dir" yields a list of files in a folder, "dir > d.txt" puts that list into the file "d.txt".

    In the latter case, I don't know.
      My Computer


  3. Posts : 1
    Windows 7 Ultimate x64
       #3

    To set how many history lines are retained:
    CMD icon > Properties > Options > Command History > Buffer Size

    To display the current history:
    doskey /history

    To save the current session's history:
    doskey /history > myhistory.txt

    To restore a previous session's history:
    alas, this does not work well as desired, but one can do...
    notepad myhistory.txt
    cut-n-paste as needed

    Addendum, since my answer was not quite relevant to the question.

    Assuming the CMD window is still open, you can use...
    CMD icon > Edit > Select All
    then open Notepad, and Edit > Paste the text into notepad.

    I do not believe there is a way to save all output (and echo'd input) in a CMD to a text file in a "live" fashion. That would be cool. (Other shells, like Cygwin bash, or PowerShell, or 4NT, or whatnot may have that capability, but that's not really germane.)
    Last edited by Eljay451; 06 Oct 2011 at 13:26. Reason: addendum to address OP's question
      My Computer


  4. Posts : 1,814
    XP / Win7 x64 Pro
       #4

    If the window pops up and goes away, there's no way that I'm aware of to save the output there. If the window is set to close after command execution (as it appears it is doing), the output has to be directed to a file at the time of the command execution. Eljay's suggestions work if the window/session stays open. However, it doesn't appear that is happening.

    Does this occur on a regular basis or did it just happen one time? At what point does this occur?
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 21:41.
Find Us