'Launch process that asks for elevation (UAC)
This is my code so far
use std::process::Command;
fn main() {
...
Command::new(r"C:\Program Files (x86)\MSI Afterburner\MSIAfterburner.exe")
.spawn()
.unwrap();
...
}
And I got this error:
{ code: 740, message: "The requested operation requires elevation." }
I found this which is probably what I need but I don't know how to do it
If anyone could make an example on how to do it that would be gladly appreciated.
Solution 1:[1]
I've found a workaround
use std::process::Command;
fn main(){
Command::new("cmd.exe")
.args(["/C",r"C:\Program Files (x86)\MSI Afterburner\MSIAfterburner.exe"])
.spawn()
.unwrap();
}
Kinda ugly but works.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Topster_ |
