I'm trying write a report in LaTeX but TeXstudio won't let me. All I have is this:


\author{---\\By: ----}




But when I click F1 to compile, TeXstudio spits this message:

Error: Could not start the command: pdflatex.exe -synctex=1 -interaction=nonstopmode "Prelab1".tex

What is the problem? Why can't I compile?

P.S: Ever since I switched from Ubuntu back to windows, writing LaTeX documents has been a massive pain T.T. What is the best LaTeX editor that won't give me a problem every single second?

  • Can you compile the file from the shell (i.e. pdflatex Prelab1)? Seems like you distribution is not correctly set up. Feb 13, 2013 at 22:37
  • 2
    @Qrrbrbirlbel i'm super new to latex so "compile the file from the shell" makes no sense to me. What exactly should I do?
    – Richard
    Feb 13, 2013 at 22:39
  • Shell means for Windows: Command line. Open up a window with one and cd to your TeX file and compile your document from there with pdflatex Prelab1. This tests if your TeX distribution is correctly installed at all. Feb 13, 2013 at 22:47

9 Answers 9


Check if the configuration is correct and that TexStudio points to the program binaries.

Wtih Windows PC: Options> Configure TeXstudio, select Build, option Default Compiler.

With OSX: texStudio > Preferences, select Build, option Default Compiler.

screenshot for OSX

As for your question about the best editor, there is a Comparison of TeX editors documented on Wikipedia, which may be of use to you.

  • where is this quick build? This is what I see i.sstatic.net/rHtbU.png
    – Richard
    Feb 13, 2013 at 22:44
  • still don't see a quick build, i.sstatic.net/WZtFc.png
    – Richard
    Feb 13, 2013 at 22:48
  • 1
    I just edited my post. I hope the change helps.
    – Umar Kalim
    Feb 13, 2013 at 22:55
  • @UmarKalim again, on windows there is no quick build option
    – Richard
    Feb 13, 2013 at 22:57
  • @Richard, my apologies. I googled a bit and it seems that the options should be under the Build Tab, as is the case in the screenshot for OSX. Also, as suggested by @Qrrbrbirlbel, testing over the command line pdflatex PreLab1 would ensure that your TeX setup is functional.
    – Umar Kalim
    Feb 13, 2013 at 23:10

I tried following the advice given here but nothing worked, even reinstalling TexStudio and Mactex didn't work. I had to go to:

TexStudio -> Options -> Restore default settings ...

Seems like a reinstall kept some preferences that I had corrupted.

  • 2
    This is the only thing that worked for me! Thanks!
    – daviewales
    Oct 11, 2017 at 9:52

Another reason for getting this error with TexStudio (which is a wonderful IDE IMHO), is that it is really trying to tell you that the .tex file does not exist. This can happen, for example, when the wrong file has been chosen as the Master document. Check the error message to see that the file it mentions is the correct master. e.g.

pdflatex.exe -synctex=1 -interaction=nonstopmode "wrongfile".tex


pdflatex.exe -synctex=1 -interaction=nonstopmode "rightfile"."wrongextension"
  • 1
    In this case, check under Options/Root document if a root document has been selected and/or search for the "magic command % !TeX root = in your .tex document. This magic command tells TXS which master document to consider.
    – ebosi
    Apr 30, 2017 at 1:19

If you installed texlive 2017 using official install-tl script on x64 linux, you can set path in tex editer to /usr/local/texlive/2017/bin/x86_64-linux.

enter image description here

  • This is the real answer. The error Could not start the command:means TS lost the command path, so you have to tell. Congrats!!!
    – tatojo
    May 9, 2020 at 16:33

Well I am unable to comment on pdmadscience's comment. I just wanted to extend his response here. I had the same issue as the original poster and adding the pdflatex command (like pdmadscience suggested) fixed the issue. In the TexStudio documentation, they also add a few switches so that the full command looks like this:

"C:\Program Files\MiKTeX 2.9\miktex\bin\x64\pdflatex" -synctex=1 -interaction=nonstopmode %.tex

(Assuming MikTek was installed in C:\Program Files)

You can also add C:\Program Files\MiKTeX 2.9\miktex\bin\x64\ to your PATH and replace "C:\Program Files\MiKTeX 2.9\miktex\bin\x64\pdflatex" with just pdflatex.

Here is the screenshot from the documentation:

No commands
(source: sourceforge.net)


I had the similar problem, but I solved it by change the path in Commands, see it in the picture. In it, you only need to correct the path to PdfLaTeX.

Hope this would help.


For me reinstalling MikTex solved the issue.

I had to delete this folder since it complained that the target directory is not empty

C:\Users\Haider\AppData\Local\Programs\MiKTeX 2.9

I had this same problem on Mac and fixed it by going to texStudio > Preferences > Commands and changing the text next to PdfLaTeX from pdflatex -synctex=1 -interaction=nonstopmode %.tex to /Library/TeX/texbin/pdflatex -synctex=1 -interaction=nonstopmode %.tex. Specifying the entire path in the command fixed it for me.

(Use the command which pdflatex in the terminal to see what the path is on your machine).


I just installed TeXStudio and found I had the same issue. Running "Build and view" opened the view window, but nothing came up and the message I received was that the view failed because the pdf file did not exist. I read one of the other previous responses to this question, and thought I would build upon it with a little more detail: I looked in the configuration settings and found that the initial installer had not set up the vast majority of the commands:

No commands

I fixed the issue by pointing to the pdflatex.exe, with with my distribution was under

<Drive>:\Program files\Miktex 2.9\miktex\bin\x64\pdflatex.exe

If you do not find the file here, I would just search for "pdflatex" in windows.

Not the answer you're looking for? Browse other questions tagged .