Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.

Windows 7: Cmd.exe - save all output/history?

13 May 2011   #1

Windows 7 64bit
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 System SpecsSystem Spec
13 May 2011   #2

Windows 7 Ultimate (x64)

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 System SpecsSystem Spec
06 Oct 2011   #3

Windows 7 Ultimate x64

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.)
My System SpecsSystem Spec

06 Oct 2011   #4

XP / Win7 x64 Pro

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 System SpecsSystem Spec

 Cmd.exe - save all output/history?

Thread Tools

Similar help and support threads
Thread Forum
Save History in Windows 7 Explorer Address Bar
Hello, I know that several people have asked how to delete the history from the Explorer Address Bar in Windows 7. I have been having trouble in saving the history. No matter which folder / directory path I've used in the path, it never shows up. Originally, this was working fine. The...
Internet Explorer 9 does not save History past 2-3 weeks
I've had this problem for years, since first upgrading to Internet Explorer 9 and Windows 7. After 2-3 weeks, Internet Explorer starts randomly choosing to disclude sites from its history, before reaching a point where it simply stops recording history. Yes, I HAVE all the settings properly...
Browsers & Mail
How can I make History to save internet visits?
History only saves visits to files etc. on the computer, not anything visited on the web. I've tried to find the answer in older posts but all I found was this.....: **************************************************** Quote: Originally Posted by 3DPiper...
Browsers & Mail
save run history
There is a option on windows 7 where if i uncheck store and display recently opened programs in the start menu it erases my run history... I only want it to erase my recently opened programs and not my run history and wanted to know if there is a way i can do this ?
Custom side and history in Open and Save Dialogs
Hello guys. WinXP has a great app named XFilesDialog, it allows us to set custom size to GetOpenFileDialog and GetOpenFileDialog, and added custom buttons so that we could add favorities and have history link to latest folders and files. But unfortunately the developer had been very lazy last...
Save as file history
Is there any way in windows 7 to clear the history of recently opened files? Everytime I do a 'save as' in any program, it brings up a list of previously opened files. Is there any way to clear this? Thanks!
General Discussion

Our Sites

Site Links

About Us

Find 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 16:55.
Twitter Facebook Google+ Seven Forums iOS App Seven Forums Android App