I need to write files in a specific directory on the file system where I have access to. But even if I can write files in the current working directory or any sub-directories, it seems that I am stock there.

For example, let's say that my test.tex file is located in this directory:


Is it possible to create a file in a directory I have access to (I created it myself), for example this one?


Currently, I am using this code, and it doesn't work:

%\immediate\openout\file="results.txt"  % This works when uncommented
\immediate\openout\file="c:/AnotherDirectory/results.txt"  % Does not work...
\immediate\write\file{Line 1}
\immediate\write\file{Line 2}
\immediate\write\file{Line 3}

I get this error message:

I can't write on file `"c:/AnotherDirectory/results.txt"'

Am I restricted by my LaTeX editor? Maybe I am not using the proper syntax?



  • 1
    This is a deliberate security setting, which you can turn off but which most of us would not recommend. – Joseph Wright Jul 15 '16 at 17:41
  • That makes sense and I agree with this! But where exactly can I turn it off? I need to export some results next week, so if I can turn it off only for a few days, it would make my life easier... – David Caissy Jul 15 '16 at 17:45
  • For your own safety: try not to modify the actual config file and instead do like this comment so that you are using doing the override temporarily. – Willie Wong Jul 15 '16 at 18:27

Browse other questions tagged or ask your own question.