I have several .tex files in different folders. The files are named: name10.tex, name20.tex, ..., name200.tex and the folders: 10, 20, ..., 200, i.e. file name25.tex is in folder 25 and file name60.tex is in folder 60. I want to automatically convert all these tex files to pdf files at the same time.

How can I do this?

I am using TeXStudio/MiKTeX on Windows 10.

  • 2
    The easiest way would probably be a batch script - maybe something like for /D %s in (path\to\main\directory\*) do pdflatex %s\name%~nxs.tex (this code is likely wrong, I can't test it right now). Just figure out what commands you need to compile one file, and the rest is more suited for Stack Overflow or SuperUser. May 16, 2019 at 9:04

1 Answer 1


I solved the problem using a batch script (as @Inquisitive Lurker recommended):

cmd path to (main) folder
for /l %i in (10,10,200) do pdflatex %i\name%i.tex

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.