I want to make a small CLI kinda project where I can execute series of commands. So, I wrote this code:
let commands = ["cd C:\\Users\\MegaMind\\Documents\\dynamodb_local_latest","dir","echo rust"];
for ccc in &commands {
let rc = Command::new("cmd")
.arg("/C")
.arg(ccc)
.output()
.expect("there was an error");
io::stdout().write_all(&rc.stdout).unwrap();
// io::stdout().write_all(&rc.stderr).unwrap();
}
It seems like it runs the dir command within the source code's folder instead of C:\\Users\\MegaMind\\Documents\\dynamodb_local_latest. How can I get the cd to take effect?