How to use Setprinter.exe

I always struggle to remember how to use setprinter.exe. So here are my tips

Set printer has 9 levels that you can query (get) about the printer. See http://britv8.com/what-are-the-setprinter-exe-levels/ for the level info.

Every query will likely be different for each printer driver make and model. So the first thing I would do is query what you have to manipulate in those levels.

An example of querying the Printer Preferences for the current user:

This particular command will show you all the level 2 settings. You will get back  something like this:

To set the Comment on the printer you would run:

To clear the comment:

Now the ones between the lines
pDevMode=…
and
…<end of devmode>

are a bit special

So if I want to set them, I have to do it slightly differently. In this example I am setting the paper width to 6cm and the height to 4cm for the user

The example above is a classic example of  what you see in the GUI is not quite what is shown in setprinter. I mean how can 600 mean 6cm!!!

All I can guess is that in the GUI, there are two decimal places when you define these settings, so 6.00 is stored as 600…..

 

3 thoughts on “How to use Setprinter.exe

Leave a comment

Your email address will not be published. Required fields are marked *