问题
This is what I have right now:
Command::new("/path/to/application")
.args("-param")
.spawn()
It looks like Rust uses CreateProcessW for running Windows processes, which allows creation flags. Perhaps there is a flag which will do what I need?
回答1:
std:os::windows::process::CommandExt extends the process::Command builder with windows-specific options when building for windows. Though no constant is defined for CREATE_NO_WINDOW so you'd either need to define it yourself or use the raw value of 0x08000000
e.g.
let command Command::new("my-command").args("param").creation_flags(0x08000000).spawn();
来源:https://stackoverflow.com/questions/59692146/is-it-possible-to-use-the-standard-library-to-spawn-a-process-without-showing-th