小编Bra*_*ams的帖子

从 Mono C# 运行 Bash 命令

我正在尝试使用此代码创建一个目录,以查看代码是否正在执行,但由于某种原因,它执行时没有错误,但从未创建过该目录。我的代码中是否有错误?

var startInfo = new 

var startinfo = new ProcessStartInfo();
startinfo.WorkingDirectory = "/home";

proc.StartInfo.FileName = "/bin/bash";
proc.StartInfo.Arguments = "-c cd Desktop && mkdir hey";
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.RedirectStandardOutput = true;
proc.Start ();

Console.WriteLine ("Shell has been executed!");
Console.ReadLine();
Run Code Online (Sandbox Code Playgroud)

c# bash shell ubuntu mono

4
推荐指数
3
解决办法
2万
查看次数

标签 统计

bash ×1

c# ×1

mono ×1

shell ×1

ubuntu ×1