diff --git a/crates/util/src/shell.rs b/crates/util/src/shell.rs index 7f7c0a1ce335d2c15fd035a1e21770fd76823af8..485e19dd1386fe4c31fbf5adb46028eac5e16983 100644 --- a/crates/util/src/shell.rs +++ b/crates/util/src/shell.rs @@ -423,14 +423,14 @@ impl ShellKind { pub fn try_quote<'a>(&self, arg: &'a str) -> Option> { shlex::try_quote(arg).ok().map(|arg| match self { - ShellKind::PowerShell => Cow::Owned(arg.replace("\\\"", "`\"")), + ShellKind::PowerShell => Cow::Owned(arg.replace("\\\"", "`\"").replace("\\\\", "\\")), + ShellKind::Cmd => Cow::Owned(arg.replace("\\\\", "\\")), ShellKind::Posix | ShellKind::Csh | ShellKind::Tcsh | ShellKind::Rc | ShellKind::Fish | ShellKind::Nushell - | ShellKind::Cmd | ShellKind::Xonsh => arg, }) }