Skip to content

Instantly share code, notes, and snippets.

Created November 5, 2016 18:30
Show Gist options
  • Save anonymous/4244b15dd26167dd62c145e10c66924b to your computer and use it in GitHub Desktop.
Save anonymous/4244b15dd26167dd62c145e10c66924b to your computer and use it in GitHub Desktop.
Shared via Rust Playground
fn create_bat_then_run_without_wait(filename_with_path_to_delete: &str) {
let bat_content = format!(r#####"
:redo
del "{}"
if exist "{}" goto redo
del %0
"#####, filename_with_path_to_delete, filename_with_path_to_delete);
let cmd_path = std::env::var("ComSpec").unwrap();
//TODO: write bat_content to a temporary file, and call ShellExecuteW
// with cmd_path to run the bat
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment