Since it's only on win32, you could probably just pass cmd.exe command explicitly, maybe something like this (untested):

```c
GString *string = g_string_new("cmd.exe /S /C \"");
g_string_append_printf(string, "cd \"%s\" & ", dir);
for (char **argp=argv; *p; p++)
  g_string_append_printf(string, "\"%s\" ", *argp);
g_string_append_printf(string, " >\"%s\" 2>\"%s\"\"", tmp_file, tmp_errfile);
ret = system(string->str);
g_string_free(string);
```

At least is seems plausible, IIRC `/S` option with `/C` just strips the outter-most quotes and leave the stuff inside it alone.