Click here to Skip to main content
15,915,065 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
This Works:

On most modern computers, PRINT will be useless, because it needs a printer port like LPT1 or COM1 etc., whereas most printers nowadays are connected either to USB ports or over a TCP/IP connection.

In those cases, a better alternative to the PRINT command is Notepad with its /P switch:

NOTEPAD /P whatever.reg

will print whatever.reg, even if .REG files aren't associated with Notepad at all (by default they aren't, and they shouldn't be).

Notepad will send its output to Windows' default printer.

But is there a way to direct the output to a nework printer that is not the default printer, using the same method?
Posted
Updated 31-Oct-12 3:49am
v2
Comments
Sergey Alexandrovich Kryukov 31-Oct-12 11:28am    
Why?
--SA

1 solution

You could change the default printer, then change it back.

To get the printer:
cscript %windir%\system32\Printing_Admin_Scripts\en-US\prnmngr.vbs -g


To set it:
cscript %windir%\system32\Printing_Admin_Scripts\en-US\prnmngr.vbs -t -p "\Servername\printername"


Unfortunately, the first returns it in the form: "The default printer is PrinterName" so you'll have to separate it out.

(And on some earlier versions of windows the script is located in %windir%\system32\ )
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900