Print Registered File Types Files that have a file type association
in Windows (95/98/NT/2000) can be printed using the right mouse button
This association can be seen, e.g. for .rtf file in the key of a registry:
"HKEY_LOCAL_MACHINE\SOFTWARE\Classes\rtffile\shell\printto\command"
where the command looks something like this:
"%ProgramFiles%\Windows NT\Accessories\WORDPAD.EXE" /pt "%1" "%2" "%3" "%4"
which means :
"wordpad.exe /pt TextFileName PrinterName [ DriverName [ PortName ] ]"
(square brackets mean optional). That mean you can use this information form the registry key to call the actual app directly from cmd according to this pattern.
Or you can call it indirectly through this association from using powershell, shipped in Windows since Vista:
powershell "-Command" "& {Start-Process -FilePath 'test.txt' -ArgumentList '\"Microsoft Print to PDF\"' -Verb 'printto' }"
Concise form of it (powershell -command "start -verb printto AnyFile.rtf PrinterName [ DriverName [ PortName ] ]") or running it from powershell prompt doesn't work on my pc for unknown reason.
It works for almost any Registered File Types with such registered verb (printto)!
UPD: To List Installed Printers wmic printer list brief
UPD: there is also a print verb. It doesn't accept any arguments the except file. So almost all the above is true if you replace printto with print and drop additional printer arguments.
But printer drivers will usually shows user dialog. User dialog showing can be disabled in Bullzip Pdf printer.