# Automatically compile several .tex files to pdf

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.

• 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. – Disenchanted Lurker May 16 '19 at 9:04

cmd path to (main) folder