# Batch file to print PDF files from a folder



## jat421 (Jun 14, 2008)

Hi,

I have created a batch file that prints PDF's from a folder. But I would like it to print only the first page of the PDF. I am using pdfp.exe to print it and it doesn't have an option to print a range. Below is the file I have so far. Any suggestions? Thanks for the help!!


```
set Printer = "Printer001"


PushD "c:\temp"
FOR /f %%a in ('dir /o-d /B "*.*"') DO (
"c:\pdf\pdfp.exe" -p %Printer% "%%a"
ping 127.0.0.1
)
PopD
```


----------



## centauricw (Jun 26, 2010)

You're SOL on this one. If the program printing the PDF doesn't support a page range, there is nothing you can do in a batch program (or most other scripting languages) to solve this. Once the pdfp.exe program has control, it won't return to the batch program until it's finished printing.


----------



## Squashman (Apr 4, 2003)

Your best bet is to keep looking for another PDF program that will do what you want. I tried searching for one for one last night but had no luck. My Google Foo failed me this time around.


----------



## jat421 (Jun 14, 2008)

Thanks guys for the help. I was thinking along the lines of using batch file to change the registry that has printer settings. Windows must save those settings somewhere I guess. I might be totally off. Thanks again for taking the time to help me.


----------



## Squashman (Apr 4, 2003)

marktech said:


> I will recommend you PDF software that can print range of PDF pages from one PDF file. You can find it from CNET downloads here.
> 
> Try it hope it works for you.


I don't see any documentation on their website that says this software can even batch print PDF file from a specific folder let alone do that and tell it to only print the first page only while doing that.


----------



## jat421 (Jun 14, 2008)

Yea I didn't find any reference to batch printing...I had to resort to Linux using lpr I was able to achieve my goal. Thanks guys for all the help!


----------

