How do I run a command in Rust?

I don't understand how to run a console command in Rust:

csscomb C:/css.css

I tried it in different ways, but then on this, then on that swears ... If that, I can't even run the calculator:

Command::new("%windir%/system32/calc.exe")
    .spawn()
    .expect("ls command failed to start");

Returns the same error:

thread 'main' panicked at 'ls command failed to start: Os { code: 2, kind: NotFound, message: "Не удается найти указанный файл." }', libcore\result.rs:1009:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.
Author: Ainar-G, 2018-10-13

1 answers

std::Command takes just the path to the executable file, first understanding it as an absolute path, and then using PATH. The use of environment variables in the file path is not allowed. They should be pulled out through std::env, and then concactenated: https://doc.rust-lang.org/std/env/index.html

 2
Author: InnocentusLime, 2019-03-19 14:02:46