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

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages 2024-01-06 20:56:40 +08:00 committed by GitHub
parent cdc31b7fc7
commit 2b4a72897e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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();