diff --git a/src/amplsolver/amplsolver.c b/src/amplsolver/amplsolver.c index 7c34712e..a150a8b4 100644 --- a/src/amplsolver/amplsolver.c +++ b/src/amplsolver/amplsolver.c @@ -271,8 +271,8 @@ int runSolver( #ifndef _WIN32 if( snprintf(command, sizeof(command), "\"%s\" \"%s\" -AMPL 2>&1", as->solver, as->filename) >= sizeof(command) ) #else - /* windows doesn't seem to like quotes around the executable name */ - if( snprintf(command, sizeof(command), "%s \"%s\" -AMPL 2>&1", as->solver, as->filename) >= sizeof(command) ) + /* windows accepts quotes around exe only if everything is quoted again */ + if( snprintf(command, sizeof(command), "\"\"%s\" \"%s\" -AMPL 2>&1\"", as->solver, as->filename) >= sizeof(command) ) #endif { /* with GAMS' limit on GMS_SSSIZE for option values and scratch dirname, this shouldn't happen */