DEV Community

Cover image for Print from Powershell
Dan Wheeler
Dan Wheeler

Posted on

Print from Powershell

Run this in Powershell - substituting the <NAMEOFPRINTER> with the name of a printer installed on your machine (or remove it entirely to use default printer):

'Hello World' | Out-Printer '<NAMEOFPRINTER>'
Enter fullscreen mode Exit fullscreen mode

To print a specific file, it's:

Get-Content 'C:\MyNote.txt' | Out-Printer '<NAMEOFPRINTER>'
Enter fullscreen mode Exit fullscreen mode

Can also be used within PSEXEC to send prints from remote computers - obviously you'll need to specify the name of a printer which is actually installed on that computer.

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more