Add page number to pdf with ghostscript
<p>I'm trying to add page numbers to all pdfs in a folder through bat script. <br>
I am unable to install any software, and hence I can only use what's on my windows machine.</p>

<p>I do have ghostscript, and some pdf readers (also Nuance which has the gr8 Pdf creator assistance which can do this in a jiffy - however, not from batch).</p>

<p>I've found this answer here: <a href="https://stackoverflow.com/questions/4766755/how-can-i-add-a-footer-to-the-bottom-of-each-page-of-a-postscript-or-pdf-file-in/6620599#6620599">How can I add a footer to the bottom of each page of a postscript or pdf file in linux?</a>      But to no success!</p>

<p>And I've saved the "code" to a .ps file. after that i run:</p>

<pre><code>for /f %%a in ('dir /b *.pdf') do (
gswin64c -q -dQUIET -dBATCH-dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=c:\folder\%%a -f AddPn2Pdf.ps )
</code></pre>