开发者

Can you execute another EXE file from within a C# console application?

开发者 https://www.devze.com 2022-12-13 13:13 出处:网络
Can you execute another EXE file from within a C#开发者_Go百科 console application? Can you pass arguments?

Can you execute another EXE file from within a C#开发者_Go百科 console application?

  • Can you pass arguments?
  • Can you get the exit code back?


Like this:

        var proc = new Process();
        proc.StartInfo.FileName = "something.exe";
        proc.StartInfo.Arguments = "-v -s -a";
        proc.Start();
        proc.WaitForExit();
        var exitCode = proc.ExitCode;
        proc.Close();
0

精彩评论

暂无评论...
验证码 换一张
取 消