use std::process::Command; pub fn kill(name: &str) -> String { Command::new("taskkill") .args(&["/IM", name, "/F"]) .output() .unwrap(); format!("Killing {}", name) } pub fn run_steam() -> std::io::Result { Command::new("cmd") .args(&["/C", "start", "steam://run"]) .output() } pub fn get_exe_path(name: &str) -> Result { let command = format!("/C wmic process where name='{}' get ExecutablePath", name); let args = command.split_whitespace().collect::>(); let output = Command::new("cmd.exe").args(&args).output()?; let out = String::from_utf8_lossy(&output.stdout).trim().to_string(); if out.contains("ExecutablePath") { let spt: Vec<&str> = out.split("\r\n").collect(); if spt.len() >= 2 { return Ok(spt[1].to_string()); } } Err(std::io::Error::new( std::io::ErrorKind::Other, "Failed to get executable path", )) }