Skip to content

An open-source remote desktop application designed for self-hosting, as an alternative to TeamViewer.

Specify cmd.exe explicitly to avoid the replacement of cmd commands (#6818)

21pages2b4a72897e72
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();