[Tex/LaTex] Windows API error 5: “Access is denied” when trying to compile TikZ picture


I installed PGF but are unable to compile the following document:

\draw (0,0) --(1,2);

This is the console output:

initexmf.exe: Windows API error 5: Access is denied.

initexmf.exe: Data: C:\
texify.exe: The operation failed for some reason.
texify.exe: Data: C:\Program Files\MiKTeX 2.9\miktex\bin\initexmf.exe

What to do?

Best Answer

You have to give yourself the permissions to read and write in MiKTeX 2.9 folder.

Go to Program Files and right click MiKTeX 2.9 folder. Then click Properties > Security Tab > Edit Button. Select Users (Bla/Bla) from the list and check all grants.

If that is not enough, click Advanced button on the Security Tab. A window named Advanced Security Settings for Folder Name pops up. Then click Auditing Tab > Continue Button > Add Button. Type Users under "Enter the object names to select" and click OK.

Or, simply don't put your MiKTeX 2.9 folder into Program Files.