Normally via cmd this is the way to run a command and to run the thing as admin!
powershell -command "&{Start-Process -filepath 'cmd' -argumentlist '/c cmd.exe' -verb
Now when I try to runt he same thing with Rust,
// Running shell scripts
use std::process::Command;
fn main()
{
let output = Command::new("powershell.exe")
.arg("powershell")
.arg(format!("-command \"&{{Start-Process -filepath 'cmd' -argumentlist '/c \"{}\"' -verb runas}}\"", "C:\\Users\\Joe\\Desktop\\testing 1\\testing.bat"))
.output()
.unwrap();
println!("{:?}", output);
}
It only works if there is no space character, but because there is a space character C:\\Users\\Joe\\Desktop\\testing 1\\testing.bat
how would I fix this?