Tuesday, May 23, 2017

Sending text to a printer in PowerShell

Notepad offers some command-line switches to print a document, but if you want to print out some text without an extra process launch or without writing text to a file, PowerShell supplies the Out-Printer cmdlet. You can specify the printer with the -Name switch; by default, without that, the text will go out your default printer. If you want to print an existing file, pipe in the output of Get-Content (gc).

No comments:

Post a Comment