+" Function: s:shellescape(s[, special]) {{{2
+"
+" Calls shellescape(), also taking into account 'shellslash'
+" when on Windows and using $COMSPEC as the shell.
+"
+" Returns: shellescaped string
+"
+function s:shellescape(s, ...)
+ let special = a:0 ? a:1 : 0
+ if exists('+shellslash') && &shell == $COMSPEC
+ let ssl = &shellslash
+ set noshellslash
+
+ let escaped = shellescape(a:s, special)
+
+ let &shellslash = ssl
+ else
+ let escaped = shellescape(a:s, special)
+ endif
+
+ return escaped
+endfunction
+