Feb 03 2021 03:42 AM
Is there a way to print all files (mainly PDFs) conatined within a folder and its sub folders with one command? It would be a tedious task having to open every file individually in order to then print it using "cmd+P" and close it again.
Thank you for any tip and advice!
Feb 03 2021 10:20 AM
Hi,
run this command in the folder, it will print only PDF files
dir *.pdf /s > printoutput.txt
run this if you want to print all files
dir > printoutput.txt
Feb 03 2021 11:02 PM - edited Feb 03 2021 11:04 PM
thank you very much! What I need is not a file containing all the file names but I need the files to be physically (i.e. on paper) printed out in our network attached printer... Is there any way to achieve this?
Thank you!
Feb 03 2021 11:34 PM
Feb 04 2021 03:23 AM
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?
Dec 21 2023 08:12 AM
Did you get an answer? im trying to do the same with about 50 pdf's and would rather not do them all individually.
Jan 16 2024 04:52 AM
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