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:
setprinter -show printername 2
This particular command will show you all the level 2 settings. You will get back something like this:
pServerName=NULL pPrinterName="printername" pShareName="" pPortName="LABZBR01" pDriverName="ZDesigner TLP 2824 Plus (EPL)" pComment="" pLocation="" pDevMode=... dmDeviceName="printername" dmSpecVersion=0x0401 dmDriverVersion=0x0400 dmSize=220 dmDriverExtra=1497 dmFields="orientation paperlength paperwidth copies defaultsource printquality color yresolution ttoption bitsperpel" dmOrientation=1 dmPaperLength=210 dmPaperWidth=510 dmCopies=1 dmDefaultSource=4 dmPrintQuality=203 dmColor=1 dmYResolution=203 dmTTOption=1 dmBitsPerPel=1 ...<end of devmode> pSepFile="" pPrintProcessor="winprint" pDatatype="RAW" pParameters="" pSecurityDescriptor="" Attributes="local docompletefirst bidi" Priority=1 DefaultPriority=0 StartTime=0 UntilTime=0 Status="" cJobs=0 AveragePPM=0
To set the Comment on the printer you would run:
setprinter.exe printername 2 "pcomment=Test comment"
To clear the comment:
setprinter.exe printername 2 "pcomment=NULL"
Now the ones between the lines
…<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
setprinter.exe printername 2 "pdevmode=dmPaperLength=400,dmPaperWidth=600"
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…..