I usually use MikTex from a command line, and a long path means I have more to type each time I wish to invoke the compiler. First, MikTex requires an empty directory -- so I can't install in the root folder. So, say I specify the directory "E:\MikTex". Then the actual MikTex .exe files for the 32-bit version get placed into


This is quite long to type each time I want to compile a file. Since the miktex and texmfs directories only have one directory in each of them, is there a way I can install the files closer to the root? I tried downloading the command line installer, but it has the same problem.

I think the idea is, to do a regular install, then move the directory to where I want it to be, and then to run initexmf.exe with the right parameters. For example, if the executables would be in E:\miktex\bin, then something like

  initexmf --portable=E:\ --log-file=E:\install.log --disable-installer --verbose --admin

should configure the options to have it work.

Would this be enough? I'm afraid to do this, mess up the installation, and get it stuck in between having it installed in one directory, and having it installed in the other directory, and not be able to use it at all.

  • You can always create a link (shortcut in windoze nomenclature). – John Kormylo Jun 30 '19 at 16:35
  • The idea is, that I'd be compiling the file in command line, thus no link is possible. – Alex Aug 20 '19 at 0:48

You should never need to specify the binary directory. (Nor the .exe for that matter)


PdfLaTeX -options file.tex  

and the system will find pdfLaTeX.exe on its path then hand over the rest of the command line.

It is desirable to have one common root folder (MiKTeX in your case) since you need separation i.e. one for the TeX&MetaFont system (texmfs) and another for your own styles texinputs etc (mytexmf) also useful to keep folders for related data like graphics bibinputs etc. etc.

Beware using a usb constantly will stress it, and in some cases it may be best to duplicate parts of a portable install into a root folder on a conventional hard drive.

It does not matter if its a portable USB install. Your start-up script on drive %~d0 needs to include a temporary addition to the system path. (It will disappear later) Use the MiKTeX start-up file as a template since it includes the essential remap fonts command.

set path=%~d0\Miktex\texmfs\install\miktex\bin;%path%
start " " "%~d0\MiKTeX\texmfs\install\miktex\bin\miktex-console"  --mkmaps

While console is running you get both a TeXworks editor and a dedicated command console that allows the direct running of just the simpler short command

It is important that it starts off as a portable install not one copied over. There have been recent related MiKTeX changes that you need to be cautious of...

Follow the current MiKTeX site instructions, "Just download the standard (basic) installer and rename it to miktex-portable.exe" exactly as they say, before you portable install, get it wrong and it can cause problems. If you see Only install for me, or all users (avoid like the plague), then you got it wrong. When it self checks its name it changes behaviour to offer c:\miktex-portable as a possible directory.

There is a minor issue about the way portable updates itself. Which can mean more maintenance on occasions. see Weird update behavior in portable MiKTeX version

  • The idea is, that this would be a portable installation; hence, the PATH variables would not point on all computers to the USB where this is installed. However, I've never heard of a mytexmf folder. Is there an advantage to using it, rather than simply keeping the .tex files in the root directory of the USB with the installer? – Alex Jun 30 '19 at 3:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.