It sounds like you've overridden some of the settings used to invoke external programs. Is your Vim set up so programs run in either Cygwin or Windows Linux Subsystem by any chance?
-u NONE -i none. Alternatively run these after starting
Does it work now? If not try
:set verbose=5 and run again. What does it say?
Vim saves the output of
system() to a temporary file before doing anything further (such as displaying the result in the Vim window). Looks like the error you are seeing is caused by having Unix style paths configured. Windows doesn't know how to interpret such paths so the write to temporary file fails.
Update: I was finally able to reproduce this. The shell settings (i.e. those related to
\) are only part of the story. There is also a quoting issue. Try
:echo system('echo "%PATH%"'). That solved the problem for me. Evaluation of the parameter passed to
system() is not as I originally assumed.
I guess there are characters in our
PATH var, encountered by Vim as it builds the redirect, that are special to Vim...by quoting them they lose their special meaning (as is often the case in shells). (And that error message about opening the temp file became a bit misleading once the slashes were fixed.)
Anyways, hopefully you can get things working now.