Windows Legacy OS forum

General discussion

How to: Send Dos console output to *.txt file?

by vmars956 / February 19, 2009 8:40 AM PST

How to: Send Dos console output to *.txt file?

I would like to keep displaying console output,
but ALSO send it to a file.
Anyone remember how to do this?

Discussion is locked
You are posting a reply to: How to: Send Dos console output to *.txt file?
The posting of advertisements, profanity, or personal attacks is prohibited. Please refer to our CNET Forums policies for details. All submitted content is subject to our Terms of Use.
Track this discussion and email me when there are updates

If you're asking for technical help, please be sure to include all your system info, including operating system, model number, and any other specifics related to the problem. Also please exercise your best judgment when posting in the forums--revealing personal information such as your e-mail address, telephone number, and address is not recommended.

You are reporting the following post: How to: Send Dos console output to *.txt file?
This post has been flagged and will be reviewed by our staff. Thank you for helping us maintain CNET's great community.
Sorry, there was a problem flagging this post. Please try again now or at a later time.
If you believe this post is offensive or violates the CNET Forums' Usage policies, you can report it below (this will not automatically remove the post). Once reported, our moderators will be notified and the post will be reviewed.
Collapse -
by Slikkster / February 19, 2009 9:42 AM PST
Collapse -
Yes, that 'redirect output' should work:
by vmars956 / February 19, 2009 1:22 PM PST
In reply to: Here...

Yes, that 'redirect output' should work:
C:\>CONSOLE >dir.txt (redirect output)

But looks like I can't have both console diaplay
and redirect to file.

However, if I could shutOff the redirect,
then I could do:
C:\>type dir.txt

Then at least I could get an afterTheFact of console log.

Collapse -
What about the TEE command?
by R. Proffitt Forum moderator / February 19, 2009 8:35 PM PST
Collapse -
You do not say what your OS is but ...
by Edward ODaniel / February 20, 2009 3:02 AM PST

with Any version of Windows NT (which includes Win 2K and Win XP as well as Vista) what you want is easy as can be.

Let us say that I want to copy console output af a directory command to a text file and also to the console where I can see it. I would enter the following commands (the bolded part is the prompt and the unbolded is what gets typed):

C:\>dir > c:\directory.txt & type c:\direct.txt

Now, that does what I want as sure enough the file directory.txt is there in the C: drive root but the text of the file scrolled past too quick to read. To fix that a little alteration and all is well:

C:\>dir > c:\directory.txt & type c:\directory.txt | more

Now, the screen shows only a sinlge page at a time and can be read at leisure.

That little & (ampersand) in the line I typed is a command separator and allows both commands to run from the same command line.

This Command Shell overview shows you the processing symbols available for your use in the command prompt and how each is used -

Collapse -
It's Stdout not console-out
by GslMusic / December 12, 2009 9:44 AM PST

Quote: "Let us say that I want to copy console output..."

That is NOT "console" output it's standard out.

Console output goes to the console, period.

Stdout CAN be redirected, just about everyone knows that.

Please get your terms straight before posting all over the place online.

Collapse -
Console (screen) output can indeed be redirected ...
by Edward ODaniel / December 17, 2009 3:04 AM PST

exactly as I indicated 10 months ago.

STDOUT normally goes to the console but can be programatically defaulted to a printer or port.

If you want to get technical please learn the facts and experiment if necessary to educate yourself to the fact that console output can be redirected and does NOT "goes to the console, period. "

This might help your education (just one of MANY sources) --

If you want to pick nits concentrate on your own.

Collapse -
How to: Send Dos console output to *.txt file?
by mhutch7714 / July 19, 2011 2:49 AM PDT


Ancient history DOS, but I seem to recall something along the lines of writing this at the command-line:

>copy con: world.txt
Hello, world!

How are you/

I am fine.
Done for now.
(That's typing ctrl-Z as the first-char of the the line)
.. and the OS would your text into the designated filename.



Popular Forums
Computer Help 51,912 discussions
Computer Newbies 10,498 discussions
Laptops 20,411 discussions
Security 30,882 discussions
TVs & Home Theaters 21,253 discussions
Windows 10 1,672 discussions
Phones 16,494 discussions
Windows 7 7,855 discussions
Networking & Wireless 15,504 discussions


The most beautiful phone ever has one wildly annoying issue

The Samsung Galaxy S8's fast speeds and fantastic curved screen make it a top phone for 2017, but the annoying fingerprint reader could sour your experience.