rust 判断 windows linux 系统

180it 2023-03-11 PM 521℃ 0条
use std::io::stdin;//1
use std::process::Command;
fn main() {

// cmd_str可以是从输入流读取或从文件里读取
let cmd_str: String;

println!("linux{}", cfg!(target_os = "linux"));
println!("windows{}", cfg!(target_os = "windows"));

if cfg!(target_os = "windows") {
    
} else {
    
}


}
支付宝打赏支付宝打赏 微信打赏微信打赏

如果文章或资源对您有帮助,欢迎打赏作者。一路走来,感谢有您!

标签: none

rust 判断 windows linux 系统