• Welcome to Overclockers Forums! Join us to reply in threads, receive reduced ads, and to customize your site experience!

DOS print command

Overclockers is supported by our readers. When you click a link to make a purchase, we may earn a commission. Learn More.

belorsch

Folding Monk
Joined
Nov 1, 2001
Location
Maryland
I am running batch file in DOS and try to get the output to go to a file. I just did this last week. I could swear I just typed in the :batch file: space and then :print: :something or other: and then there was a file in the dir I had run the batch command from named print. I opened the file using notepad and saved it under a different name with the .txt extension and I was good to go. Is anyone getting this :rolleyes: ;)
 
:confused:

I think you are asking how to print a document from a batch file

this is the command you need to use

C:\My Documents>type file.txt > prn

just edit it to your likeing.

hope that helps
 
SinsFeelNatural said:
:confused:

I think you are asking how to print a document from a batch file

this is the command you need to use

C:\My Documents>type file.txt > prn

just edit it to your likeing.

hope that helps
Heh, originally I wanted to save the output(results that scroll by after the batch file is run??) as a txt file but couldn't figure out how so I decided to just try and print it. Well the printer I print to is on the network so somehow it just came out as a file which is what I wanted in the first place. But I can't duplicate that now. Its really kind of weird, but then thats me :p
 
If you want to have the batch file's output be written to a device (a file, or printer), then what you'll need to do is type this out...

MyBatchFile.BAT > DEVICE

Where DEVICE is a filename (1.txt, SUSHI.doc, ect.) or a actual device (CON=Monitor, PRN=Printer, LPT1=LPT1 port, COM1=COM1 port, ect. [I think those are right anyway....])

So, now you can have it write to a file (or printer) if you want :) The only real problem though is that it will not display any prompts on screen. They will go right to the file (or printer) and you'll never see them. So be sure you know what keys to press if your batch file needs them!

JigPu
 
Back