0

I'm using a simple batch file calling the xpdf engine to convert a PDF to a TXT file. Right now, the resulting txt file's name is the same as the PDF's, except the extension has been changed to .txt of course. However, I want to add some text behind the original file name, how can I do this? For example, if there's a PDF called test.pdf, it should be converted to text and stored in a txt file called testFULL.txt.

This is the current batch file I have: for /R %%s in (*.pdf) do "C:\xpdf\bin32\pdftotext" -raw "%%s"

  • I would think you would have to look at the help for your conversion program to see if you can specify an output file name. – Squashman Feb 14 '17 at 14:56
  • See if your conversion program can accept a parameter like this **`"%%~dpnsFULL%%~xs"`** as your output filename with **`"%%s"`** as the input filename. – Compo Feb 14 '17 at 15:04
  • @Compo, `Usage: pdftotext [options] []` (from executing `pdftotext.exe` without arguments) – MC ND Feb 14 '17 at 15:20

1 Answers1

0

Based on the comment showing that the output text file is a parameter:

for /R %%s in (*.pdf) do "C:\xpdf\bin32\pdftotext" -raw "%%s" "%%~dpnsFULL.txt"
Compo
  • 36,585
  • 5
  • 27
  • 39