# pdflatex can't find aux file [closed]

I'm trying to automate the creation of PDF documents from tex files via command line.

I use the command pdflatex C:\files\001.tex and files named 001.aux, 001.dvi, 001.log, 001.toc are created in the same folder, but I get the message:

! I can't find file `001.aux '

But it really is in that folder. When ask " Please type another input file name: " I have the option of manually write C:\files\001.aux , but I can`t do this all the time.

Even if i write pdflatex --output-directory="C:\files" --aux-directory="C:\files" C:\files\001.tex I get the same result

## closed as off-topic by Martin Schröder, jub0bs, Andrew Swann, Peter Jansson, moeweFeb 9 '14 at 12:38

• This question does not fall within the scope of TeX, LaTeX or related typesetting systems as defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

• Perhaps you can show the details of how you are automating the process may be the bash/bat script. – user11232 Feb 8 '14 at 16:27
• Bat contains only one line per file: pdflatex --output-directory="C:\files\001" --aux-directory="C:\files\001" C:\files\001\001.tex – user45725 Feb 8 '14 at 16:37
• pdflatex will look for files in the folder where your started pdflatex not where the main file resides. Switch to C:\files in your batch file with cd and then call pdflatex 001.tex. – Ulrike Fischer Feb 8 '14 at 16:53
• I think that's not the problem. If i open a ms-dos console and write cd C:\Programas\MiKTeX29\miktex\bin In that folder there is a file called 001.tex Then i write pdflatex 001.tex but I get the same error. !I can't find file `001.aux ' – user45725 Feb 8 '14 at 17:11
• This question appears to be off-topic because the program was started from a read-only directory. – Martin Schröder Feb 9 '14 at 11:48

Put these as the contents of your bat file (say `compile.bat`)

``````@ECHO ON
cls
REM ECHO.

REM compile the tex document with pdflatex

CD /D %~dp0
pdflatex --output-directory="C:\files\001" --file-line-error --interaction=nonstopmode "001.tex"
Pause
``````

Save the `compile.bat` in the same folder as the main file (i.e., `001.tex`).

For a list of valid options to `pdflatex`, refer to this link or run `pdflatex --help` from command prompt. Add as many options as you wish in the batch file (I have added some).

• The option `--aux-directory` exists for pdflatex. But it is a MiKTeX specific option. – karlkoeller Feb 8 '14 at 17:53
• Your bat work fine. Now i know where my mistake was. I was testing from my MikTex installation directory (C:\Programs\MiKTeX29\miktex\bin). For some reason I do not understand if some file (example: 001.tex) is in that location will give the error that I described. Thank you. – user45725 Feb 8 '14 at 17:58
• @karlkoeller Good to know. Where can we find these details for miktex? – user11232 Feb 8 '14 at 22:37
• @user45725 From windows vista onwards, writing in Program Files is restricted. – user11232 Feb 8 '14 at 22:39
• @HarishKumar `pdflatex --help` – karlkoeller Feb 9 '14 at 0:22