# Starting TexStudio from batch file doesn't compile

I'm using MikTex portable and TexStudio on a USB drive. On the top most folder level I placed a batch file starting the texstudio.exe. When I try to compile any document, it doesen't run the command makeindex. Then I tried to start TexStudio via it's orginal texstudio.exe and it worked perfectly.

So I think the problem lies somewhere in my batch file, maybe something regarding the user permissions?

I would be glad if someone can help me on that :)

• post the content of your batch file. – naphaneal Dec 2 '18 at 11:20
• Can you post a screenshot of your textudio preferences? This sounds like it might be a problem with your path, which is different for things launched from a batch file than with clicking on icons. – book Dec 2 '18 at 13:09
• Did you specify the full path to makeindex or do you rely that the program is found within your \$PATH variable? – book Dec 2 '18 at 13:15
• mmm, the relative paths look fine, as far as I can tell. So maybe not a problem with paths. – book Dec 2 '18 at 13:28
• Do you get any error message when you try to run makeindex? – book Dec 2 '18 at 13:29

Generally (corporate installations excepted) one of the reasons for a portable TeX installation is the ease with which one current copy can be used on different platforms and with different editors (i.e. my requirements) Keeping the different parts in separate folders is ideal and a top level batch file makes sense. So the typical contents of such a batch file may be

DO NOT use this one it is just an example of steps to consider

First are there additional dependencies such as Perl for latexmk or pdf viewer or converters like GS note in this first case there are NO quotes because there are no spaces

set path=%~d0\Imagemagic\imagemagick;%~d0\GS\ghostscript;%path%


Obviously MiKTeX (or TeX Live etc.) need to be on path and in this case quotes are needed because there is a space

set PATH="%~d0\MiKTeX app\texmfs\install\miktex\bin;%path%"


You will need something to let you update MiKTeX on the fly etc and the simplest is to let it run in the background (remember this is not a working example use your own paths)

start "" "%~d0%~p0texmfs\install\miktex\bin\miktex-console.exe" --hide --mkmaps


Lastly we need our editor (perhaps with optional variable for drag and drop a tex file)

"%~d0\tex studio\texstudio2.12.14\texstudio.exe" "%1"


It is useful to keep the dos console open to allow command line usage or checking

So a final line could be

%comspec% /k