Pastey win32: system_exec with quotes fix ( http://openeuphoria.org/forum/122119.wc ) -

diff --git a/be_runtime.c b/be_runtime.c
--- a/be_runtime.c
+++ b/be_runtime.c
@@ -4880,8 +4880,8 @@
 		if (cmdline[i] == '\0')
 			break;
 		if (cmdline[i] == '\"') {
-			i++; // skip leading double-quote
 			argv[w++] = &cmdline[i]; // start of new quoted word
+			i++;
 			while (cmdline[i] != '\"' &&
 				   cmdline[i] != '\0') {
 
@@ -4894,7 +4894,8 @@
 
 				i++;
 			}
-
+			if (cmdline[i] == '\"')
+				i++;
 		}
 		else {
 			argv[w++] = &cmdline[i]; // start of new unquoted word
@@ -4968,6 +4969,7 @@
 {
 #ifndef EUNIX
 	char **argv;
+	char *argvNDQ; // Without double-quote
 #endif
 	char *string_ptr;
 	int len, w, exit_code;
@@ -5003,9 +5005,17 @@
 	exit_code = system(string_ptr);
 #else
 	argv = make_arg_cv(string_ptr, &exit_code);
-	exit_code = spawnvp(P_WAIT, argv[0], (char const * const *)argv);
-
-	EFree(argv[0]);		// free the 'process' name
+	
+	argvNDQ = (char *)EMalloc(strlen(argv[0])+1);
+	if (argv[0][0] == '\"') { // Assume argument is surrounded by double-quote and remove them
+		copy_string(argvNDQ, argv[0]+1, strlen(argv[0])-1);
+	} else {
+		copy_string(argvNDQ, argv[0], strlen(argv[0])+1);
+	}
+	
+	exit_code = _spawnvp(P_WAIT, argvNDQ, (char const * const *)argv);
+
+	EFree(argvNDQ);		// free the 'process' name
 	EFree((char *)argv); // free the list of arg addresses, but not the args themself.
 
 #endif