Question

It seems like the PrintUI.dll has a different error handling system than the typical command. If I try to run a conditional command like:

(rundll32 printui.dll,PrintUIEntry /y /n "foo") & (echo Success) | (echo Fail)

This command will evaluate as false but the error alert isn't suppressed. How do I suppress these alerts?

Error:

enter image description here

Was it helpful?

Solution

I found the answer. You must include Modification Parameter /q.

(rundll32 printui.dll,PrintUIEntry /y /n /q "foo") & (echo Success) | (echo Fail)

MS Documentation: http://technet.microsoft.com/en-us/library/ee624057.aspx

OTHER TIPS

An alternative to rundll32 and printui.dll is to use the VBS printer utility script that ships with windows: prnmngr.vbs. When using this script no dialogs are created.

Example (running in cmd.exe):

cscript %WINDIR%\System32\Printing_Admin_Scripts\en-US\Prnmngr.vbs -a -p "my printer"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top