From 2b4a72897e72a27c7ccdfd185524268a97c351e8 Mon Sep 17 00:00:00 2001 From: 21pages Date: Sat, 6 Jan 2024 20:56:40 +0800 Subject: [PATCH] Specify cmd.exe explicitly to avoid the replacement of cmd commands (#6818) Signed-off-by: 21pages --- src/platform/windows.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/platform/windows.rs b/src/platform/windows.rs index 504557d50..84ca39e1e 100644 --- a/src/platform/windows.rs +++ b/src/platform/windows.rs @@ -1222,8 +1222,9 @@ fn run_cmds(cmds: String, show: bool, tip: &str) -> ResultType<()> { let tmp2 = get_undone_file(&tmp)?; let tmp_fn = tmp.to_str().unwrap_or(""); // https://github.com/rustdesk/rustdesk/issues/6786#issuecomment-1879655410 - // Execute the .bat file directly to avoid the replacement of cmd - let res = runas::Command::new(&tmp_fn) + // Specify cmd.exe explicitly to avoid the replacement of cmd commands. + let res = runas::Command::new("cmd.exe") + .args(&["/C", &tmp_fn]) .show(show) .force_prompt(true) .status();