# How to run shell command with \write18?

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 ?

EDIT:

I got this line from the log file:

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

\documentclass{report}
\immediate\write18{cmd.exe}
\begin{document}
...
\end{document}

• 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.
\immediate\write18{start cmd.exe}