Cmd.exe - save all output/history?

ny8u7y

New member
Local time
3:33 PM
Messages
4
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 My Computer

OS
Windows 7 64bit
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 My Computer

Computer Manufacturer/Model Number
Dell Inspiron 530
OS
Windows 7 Ultimate (x64)
CPU
Q6600
Memory
8 GB
Graphics Card(s)
ATI Radeon HD 2600 XT
Monitor(s) Displays
Samsung Syncmaster P2450
Screen Resolution
1920x1080
Hard Drives
Samsung HD103UJ
Samsung HD501LJ
Internet Speed
25 Mb/s
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:

My Computer My Computer

OS
Windows 7 Ultimate x64
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 My Computer

OS
XP / Win7 x64 Pro
CPU
Intel Quad-Core Q9450 @ 3.2GHz
Motherboard
Asus P5-E
Memory
2x2GB GSkill DDR2
Graphics Card(s)
NVIDIA GeForce 8600 GTS (EVGA)
Monitor(s) Displays
Dell 2408WFP
Screen Resolution
1920x1200
Back
Top