In the first scenario, you could for example change the system default printer using:
rundll32 printui.dll,PrintUIEntry /y /q /n “PRINTER_NAME”
where the /q flag suppresses error notices - you may want to omit it if something goes wrong to do some debugging - and PRINTER_NAME is the exact name of the printer as shown from the "Devices and printers" control panel window.
The second scenario relies upon a tool to invoke scripts and one of the script utilities found under the %WINDIR%\System32\Printing_Admin_Scripts\ folder; here language depends on your system, it may be en-US, it-IT or whatever. In our example you would:
cscript.exe "%WINDIR%\System32\Printing_Admin_Scripts\LANGUAGE\Prnmngr.vbs" -t -p "PRINTER_NAME"
Of course, you can invoke those commands programmatically too.
No comments:
Post a Comment
With great power comes great responsibility