I want to use the command \write18 with shell or other excutables rather than only a restricted list of programs as it says here: https://tex.stackexchange.com/a/20446/92620

How can i bypass the restrictions set on \write18 to execute external/shell from documents ?


I got this line from the log file:

runsystem(cmd.exe)...disabled (restricted).

  • Run pdflatex (or other engine) with the -shell-escape option. – egreg May 23 '16 at 19:49
  • Which editor do you use? – Bernard May 23 '16 at 19:54
  • @egreg i already tried -shell-escape same as with --enable-write18 i believe it's double hyphen -- pdflatex -synctex=1 -interaction=nonstopmode --shell-escape %.tex, shell didnt run. @Bernard TexMaker – SAM May 23 '16 at 20:01
  • Did you configure TeXmaker to use the --enable-write18 switch for pdflatex? – Bernard May 23 '16 at 20:20
  • @Bernard yes i did – SAM May 23 '16 at 20:30

I don't think that cmd.exe was ever directly allowed (in restricted mode). You need to run your document with --shell-escape.

When I try your document I get a prompt in the window where pdflatex compiled the document.

If you want a new cmd.exe windows you should probably use

\immediate\write18{start cmd.exe} 

(again --shell-escape is needed).

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.