I want to execute a batch file from c#.net code. A batch file may take unknown number of the command line arguments. I want to pass these arguments from c# code.
我想从c#.net代码执行批处理文件。批处理文件可能会使用未知数量的命令行参数。我想从c#代码中传递这些参数。
How this can be achieved through c#?
如何通过c#实现这一目标?
Edit : I have written following code
编辑:我写了以下代码
ProcessStartInfo psi = new ProcessStartInfo(filePath);
psi.WindowStyle = ProcessWindowStyle.Hidden;
psi.CreateNoWindow = true;
psi.Arguments = "some value";
Process proc = new Process();
proc.StartInfo = psi;
proc.Start();
1 个解决方案
#1
0
Look at http://www.dotnetperls.com/process-start-vbnet for a good introduction. Specifically, see the "Run executable" example at the bottom.
请访问http://www.dotnetperls.com/process-start-vbnet以获得详细介绍。具体来说,请参阅底部的“运行可执行文件”示例。
Here is the search query I used http://www.bing.com/search?q=command+line+parameters+process+start, if you need more examples.
以下是我使用的搜索查询http://www.bing.com/search?q=command+line+parameters+process+start,如果您需要更多示例。
#1
0
Look at http://www.dotnetperls.com/process-start-vbnet for a good introduction. Specifically, see the "Run executable" example at the bottom.
请访问http://www.dotnetperls.com/process-start-vbnet以获得详细介绍。具体来说,请参阅底部的“运行可执行文件”示例。
Here is the search query I used http://www.bing.com/search?q=command+line+parameters+process+start, if you need more examples.
以下是我使用的搜索查询http://www.bing.com/search?q=command+line+parameters+process+start,如果您需要更多示例。