添加cmd
This commit is contained in:
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -4062,7 +4062,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "slint_test"
|
||||
version = "0.1.0"
|
||||
version = "0.2.0"
|
||||
dependencies = [
|
||||
"slint",
|
||||
"slint-build",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "slint_test"
|
||||
version = "0.1.0"
|
||||
version = "0.2.0"
|
||||
edition = "2024"
|
||||
license = "Apache-2.0"
|
||||
authors = ["3872006562@qq.com"]
|
||||
|
||||
@@ -31,6 +31,13 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
main_window.on_launch_taskmgr(|| {
|
||||
let _ = Command::new("taskmgr.exe").spawn();
|
||||
});
|
||||
main_window.on_launch_cmd(|| {
|
||||
if let Ok(user_profile) = std::env::var("USERPROFILE") {
|
||||
let _ = Command::new("cmd.exe").current_dir(user_profile).spawn();
|
||||
} else {
|
||||
let _ = Command::new("cmd.exe").spawn();
|
||||
}
|
||||
});
|
||||
|
||||
let _ = main_window.run();
|
||||
Ok(())
|
||||
|
||||
@@ -16,6 +16,7 @@ export component MainWindow inherits Window {
|
||||
Button { text: "远程桌面连接"; clicked => { root.launch_mstsc(); } }
|
||||
Button { text: "字符映射表"; clicked => { root.launch_charmap(); } }
|
||||
Button { text: "任务管理器"; clicked => { root.launch_taskmgr(); } }
|
||||
Button { text: "CMD"; clicked => { root.launch_cmd(); } }
|
||||
}
|
||||
callback launch_powershell();
|
||||
callback launch_security_center();
|
||||
@@ -25,4 +26,5 @@ export component MainWindow inherits Window {
|
||||
callback launch_mstsc();
|
||||
callback launch_charmap();
|
||||
callback launch_taskmgr();
|
||||
callback launch_cmd();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user