Forum Discussion
How print all files in folder and sub folders?
Rightclicking on every file and selecting "Print" would take far too long. I would like to find some way to automate this process and not having to manually click on every file. I rather would like to have some batch file which completes the task of printing out all PDFs in a folder as well as all PDFs in potential sub folders without me having to do this manually. Is there a way/command to do this?
Did you get an answer? im trying to do the same with about 50 pdf's and would rather not do them all individually.
- HotCakeXJan 16, 2024MVP
Here is another code snippet using PowerShell
# Get the name of the printer $printer = Read-Host -Prompt "Enter the name of the printer" # Get the path of the folder $folder = Read-Host -Prompt "Enter the path of the folder" # Get all the PDF files in the folder and its subfolders $files = Get-ChildItem -Path $folder -Recurse -Filter "*.pdf" # Loop through each file and print it foreach ($file in $files) { Start-Process -FilePath $file.FullName -Verb PrintTo $printer }The $printer variable is used to store the name of the printer that you want to print the PDF files to. You can enter the name of the printer when the code prompts you, or you can modify the code to assign a specific value to the $printer variable. For example, if you want to print to the printer named “HP LaserJet 1020”, you can change the first line of the code to:
# Get the name of the printer $printer = "HP LaserJet 1020"You can use the Get-Printer cmdlet to retrieve a list of printers installed on your computer or a remote computer1. You can also use the Out-Printer cmdlet to send output to a printer