diff --git a/maven/src/org/netbeans/modules/maven/execute/MavenCommandLineExecutor.java b/maven/src/org/netbeans/modules/maven/execute/MavenCommandLineExecutor.java --- a/maven/src/org/netbeans/modules/maven/execute/MavenCommandLineExecutor.java +++ b/maven/src/org/netbeans/modules/maven/execute/MavenCommandLineExecutor.java @@ -279,7 +279,11 @@ for (Map.Entry entry : config.getProperties().entrySet()) { if (!entry.getKey().startsWith(ENV_PREFIX)) { //skip envs, these get filled in later. - toRet.add("-D" + entry.getKey() + "=" + (Utilities.isWindows() ? entry.getValue().replace(quote, escaped) : entry.getValue().replace(quote, "'"))); + String val = entry.getValue(); + if (Utilities.isWindows()) { + val = val.replace("\"", "\"\""); + } + toRet.add("-D" + entry.getKey() + "=" + val); } } diff --git a/openide.util/src/org/openide/util/Utilities.java b/openide.util/src/org/openide/util/Utilities.java --- a/openide.util/src/org/openide/util/Utilities.java +++ b/openide.util/src/org/openide/util/Utilities.java @@ -1575,6 +1575,7 @@ final int slen = s.length(); char c; + boolean win = isWindows(); for (int i = 0; i < slen; i++) { c = s.charAt(i); @@ -1585,14 +1586,14 @@ continue; } - if (c == '\\') { + if (c == '\\' && !win) { sb.append('\\').append('\\'); continue; } if (c == '"') { - sb.append('\\').append('"'); + sb.append(win ? '"' : '\\').append('"'); continue; }