Tag Archives: utilities

CLP – Command Line Text File List Program

I’ve decided to post some of the useful small programs I’ve written for my own use.

CLP is a simple C# console program that lists text files on a Windows printer. It was originally intended to list C source code, but it is useful for printing many kinds of text files. Yes you can use Notepad for this but CLP has some useful differences and additional features:

1. As a command line program that takes a filename as an argument, you can put it in your SendTo list and thus be able to list text files from a right-click.

2. CLP puts a header in bold on each page with the filename, the file date and time (not the current date), and the page number.

3. Output is in a fixed-pitch font, which makes outputting things like tables easy.

4. Printed lines are about 72 characters long. Continuation lines are used for lines that are too long. Continuations are marked with bullet characters to make it clearer that they are continuations.

5. Output is to any Windows printer. A CLP default printer selection is maintained, with the ability to list available printers and select a new default from the command line.

6. Files to list can be specified with wildcards or through the use of a file containing a list of filenames.

7. Operating instructions can be displayed by simply entering the program name with no arguments. The resulting output looks like this:

C:\Users\Jim>clp
clp default printer: HL-5250DN 2-sided

clp - print file(s) to clp default printer - 12/25/16 (.NET)

To execute enter: clp [namfl1...namfln] [-p[n]]

where each namfl is a file to print
namfls can use paths and wildcards
an @namfl prints files named in namfl.nms
namfl.nms entries can use paths
namfl.nms entries cannot use wildcards or @namfls
-p lists available printers by number
-pn selects clp default printer n
printer selections are saved between runs
(clp has its own default printer)

The program is written in C# using the .net library. Here is a zip file containing source and executable files: CLP.zip

Enjoy!

-jimc