If that execution is handled by a shell instead of going directly through an operating system's CreateProcess() function, then the command line string may be mangled either by the shell, or some other "helpful" code sitting inbetween which tries to resolve backslash-escapes (which are usually needed in front of quotation marks).
It a very typical problem in cross-platform Python code, and I think I also stumbled over it in Node.js.
The canonical way to solve this would be to pass the components of that command line through a function that escapes or quotes anything that needs to be escaped. In Ruby and when using bash for example we have [0].
Does Windows have something similar?
[0]: https://ruby-doc.org/stdlib-2.5.1/libdoc/shellwords/rdoc/She...