Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Print dos screen

Posted on 2003-03-13
Medium Priority
Last Modified: 2007-12-19
I have written a batch file that copies windows files and then writes a log file once copying is complete. I wan't a basic printout of the event to make sure everything is copied sucessfully, but the log printout would be equivalent to about 50 pages.

Is there any way that I can send the dos screen to the printer so that I get a printout such as

15 files copied in 5 folders
The following files could not be copied...


If not is there a way to filter the log file and then send that to the printer?

Any input would be appreciated.
Question by:Paduwan
  • 2
  • 2
  • 2
  • +1

Expert Comment

ID: 8133274
NO, not that I know of.

Expert Comment

ID: 8133279
Do you want the Print out done manually, or as part of the script?
 - In you're running in pure DOS mode, hitting Prnt Scrn will send the current screen direct to LPT1. (In Windows it copies it to the Clipboard)

Possibly use the TYPE and FIND commands to filter the text file, eg

TYPE yourlog.txt |FIND /i "files copied in" >LPT1
TYPE yourlog.txt |FIND /i "not copied" >LPT1

The only problem is that this works line-by-line, so you would have to specify a unique seach string (like the "not copied" above) to get only the lines that you want. Is there something unique about the lines containing the errors that you could use?

But there are probably better ways of doing it in the batch file itself - could you post the contents of that file here?

Expert Comment

ID: 8133335
good point pjbcba, I also think ther is a command string you can add to the end to stop the carrage return so that it won't print each line on a seperate piece of paper, But it's been so long since I touched that area of DOS that I have fergotten what it is.
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.


Author Comment

ID: 8133588
The printing has to be done from within the script, as the file copying will occur after hours through scheduling. I want a print out to be there in the morning so I can quickly browse over it and know that all files have been copied.

I'll post the script shortly...
LVL 50

Expert Comment

ID: 8133792
Probably for each copy or xcopy command you want to do something like

First line of script

copy c:\*.* d:\*.*  > logfile.txt

All other lines involving copying

xcopy c:\*.*   d:\*.*  >>  logfile.txt
copy c:\*.*   d:\*.*   >> logfile.txt

and the last line of the script

type logfile.txt > prn

Author Comment

ID: 8133845
There is only one copy command in the script, which copies around 2000 files.

Do you think this makes sense as a sort of filter:

>find "string" [path_to_logfile] > filename.txt

print filename.txt

So the find command searches the log file for only the information I want, exports it to a text file which is then printed?

LVL 50

Accepted Solution

dbrunton earned 40 total points
ID: 8133895
Yes.  Something like that should work.  Test it on a small number of files first.

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The following is a collection of cases for strange behaviour when using advanced techniques in DOS batch files. You should have some basic experience in batch "programming", as I'm assuming some knowledge and not further explain the basics. For some…
Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Integration Management Part 2
Suggested Courses

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question