How do you print any printable file in Windows 10 by command line?

Print option

How do you print any printable file by command-line in Windows 10? Images, PDF, text, word documents and such. This question refers too all files you can print by right-clicking and selecting print from the menu that opens up.

asked Dec 27, 2020 at 20:23 210 2 2 gold badges 6 6 silver badges 18 18 bronze badges see if it's helpful to you: community.spiceworks.com/topic/… Commented Dec 28, 2020 at 8:20

Sorry, we don't do software recommendations here. Try over on softwarerecs.stackexchange.com and expand on your use case a bit.

Commented Jan 5, 2021 at 2:17

@Karu, you are right. I misworded my question. I basically wanted a way to make Windows print every document that is dropped in a specific directory. I guessed it should be 'simple' but apparently it is not as common a use case as I thought! I will rephrase my question!

Commented Jan 5, 2021 at 12:28

@GloriaGu Thank you! This is actually relevant. Have an ice day. Note for future users: the useful answers are somewhere down in the bottom of that page.

Commented Jan 8, 2021 at 16:25

2 Answers 2

PowerShell can print any file, using the same action as the Print verb defined for the file-type.

The PowerShell command to use is Start-Process, and the idea is simply to invoke the file itself with the Print verb.

The syntax is very simple:

Start-Process "path-to-file" -Verb print 

I tested it with a PDF file, and the file printed correctly.

A more elaborate example is to be found in the documentation:

Example 2: Print a text file

This example starts a process that prints the C:\PS-Test\MyFile.txt file.

Start-Process -FilePath "myfile.txt" -WorkingDirectory "C:\PS-Test" -Verb Print