pdflatex cannot find my .tex file

For some strange reason pdflatex.exe apparently can't find the .tex file I'm trying to process in the Windows terminal.

I open the terminal, navigate to the appropriate folder and enter the following command:

\miktex\bin\pdflatex.exe test.tex


I get the following error message:

This is pdfTeX, Version 3.1415926-2.5-1.40.14 (MiKTeX 2.9)
entering extended mode
! I can't find file test.tex'.


I'm 100% sure that I'm in the correct directory and that the file test.tex is there.

Any help would be greatly appreciated!

• Which folder is text.tex in? – Joseph Wright Jan 14 '15 at 20:49
• What does the dir command in the folder where your file should be, show? – Juri Robl Jan 14 '15 at 21:07
• It's in the same directory from which I'm running the command. If I run dir I can see the file there. I actually got it work a bit by entering \miktex\bin\pdflatex.exe .\test.tex. But now I get another error message: "! I can't find the file test.aux'". – Manuel R Jan 14 '15 at 21:12

Your version of MiKTeX seems to be a little bit outdated.

My current version is:

pdfTeX, Version 3.14159265-2.6-1.40.15 (MiKTeX 2.9), yours is

pdfTeX, Version 3.1415926-2.5-1.40.14 (MiKTeX 2.9).

If your MikTeX is well installed the following is working:

1. Open Windows terminal
2. Change to the directory with test file HelloWorld.tex: cd test. You will see something like (I didn't change the language German, no problem here):

Verzeichnis von C:\Users\Internet\Desktop\LaTeX\TeX.SX\test

1. Test, that the file is there: dir Helloworld.*. Should result in:

08.02.2015 23:06 76 HelloWorld.tex

1 Datei(en), 76 Bytes

2. Type: pdflatex HelloWorld. The last two lines on sreen are:

Output written on HelloWorld.pdf (1 page, 12439 bytes).

Transcript written on HelloWorld.log.

3. Check result: dir HelloWorld.*. You should see:

Verzeichnis von C:\Users\Internet\Desktop\LaTeX\TeX.SX\test

08.02.2015 23:20 9 HelloWorld.aux

08.02.2015 23:20 5.317 HelloWorld.log

08.02.2015 23:20 12.439 HelloWorld.pdf

08.02.2015 23:06 76 HelloWorld.tex

4 Datei(en), 17.841 Bytes

0 Verzeichnis(se), 427.102.679.040 Bytes frei

The simple MWE HelloWorld.tex for this is:

\documentclass{scrartcl}
\begin{document}
Hello World!
\end{document}


There should be no need to give the path for pdflatex. Windows should recognize the right path to the program pdflatex.exe. If not you have a problem with your installation and I would suggest to install the current MiKTeX!

Hope this helps you ...

I had a similar problem; MikTeX was unable to find files in the current directory. I tried renaming the file; this did not help. I then moved the file to a different directory, and the problem went away.

I believe the key point is that the problematic directory was inside a "local/texmf" (FNDB) directory that MikTeX manages so it can find the TeX installation. To confirm this, I moved the file to yet another such directory, and again MikTeX reports not being able to see the file.

So, the bottom line is: MikTeX will not let you invoke it to process files inside an FNDB directory.

• You can add a new directory/file using the package manager. – John Kormylo Dec 2 '15 at 15:15

I had pretty much the same problem but solved it differently than the other answers here.

I had been trying to get a program that interfaces with LaTeX to work. In the process I changed the environment variable TEXINPUTS to point to a directory. After doing that I was unable to use pdflatex to compile anything. Unsetting the variable made it start working again.

If you haven't done anything to your environment variables they're probably not the problem, but just in case you could check for anything suspicious with the env command (or whatever command displays environment variables in Windows).

If your tex file is inside a folder whose path contains spaces or "non-English" characters, this problem might occur. Just move to another folder with "normal" path.