I\'m using gvim on Windows.
In my _vimrc I\'ve added:
set shell=powershell.exe
set shellcmdflag=-c
set shellpipe=>
set shellredir=>
function!
Interesting question - here is something else to add to the confusion. Without making any changes to my .vimrc file, if I then run the following commands in gvim:
:set shell=powershell.exe
:set shellcmdflag=-noprofile
:echo system("dir -name")
It behaves as expected!
If I make the same changes to my .vimrc file, though (the shell and shellcmdflag options), running :echo system("dir -name") returns the nonsense characters!