[英]executing multiple line commands without using a batch file in c#
Is there a way i can execute multiple commands in c# without writing it to a batch file first? 有没有一种方法可以在c#中执行多个命令而无需先将其写入批处理文件?
I have found how to do that using batch file. 我已经找到了如何使用批处理文件来做到这一点。 But I need to know how to do this without creating a batch file. 但是我需要知道如何在不创建批处理文件的情况下执行此操作。
You can use Process Class: 您可以使用Process Class:
Process Class Provides access to local and remote processes and enables you to start and stop local system processes. 进程类提供对本地和远程进程的访问,并使您能够启动和停止本地系统进程。
myProcess.StartInfo.UseShellExecute = false;
myProcess.StartInfo.FileName = "C:\\HelloWorld.exe";
myProcess.StartInfo.CreateNoWindow = true;
myProcess.Start();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.