Todays update in the stable miktex seems to have resolved Bug #2597. But \write18 still doesn't work correctly with xetex. One failing example is
\documentclass{article}
\begin{document}
blub
\immediate\write18{kpsewhich article.cls }
\end{document}
which works fine with e.g. pdflatex --shell-escape test-utf8
but fails with xelatex --shell-escape
with the message
(D:\MiKTeX2.9\tex\latex\base\size10.clo)) (test-utf8.aux)Der Befehl "kpse" ist entweder falsch geschrieben oder konnte nicht gefunden werden.
On tex.SX there is another error report involving the tikz externalize library, which could be caused by the same bug: https://tex.stackexchange.com/questions/366191/is-there-a-write18-bug-in-xetex-or-am-i-doing-something-wrong