【发布时间】:2016-01-25 01:15:36
【问题描述】:
我想遍历文件夹中的所有图像,检索每个图像的名称并使用名称传递一个参数。这就是我所拥有的:
foreach (string imageFile in Directory.EnumerateFiles(filePath))
{
//Get image name and save it as string
string args = "something"; //a line of argument with image name in it
Process.Start("cmd", @"/c cd C:\Tesseract-OCR && " + args);
}
上述代码的问题在于,对于每个图像文件,它都会打开一个新的命令提示符。相反,我想要类似的东西:
Process.Start("cmd", @"/k cd C:\Tesseract-OCR");
foreach (string imageFile in Directory.EnumerateFiles(filePath))
{
//For each imageFile I have, pass an argument to the opened cmd prompt
}
【问题讨论】:
标签: c# command-line cmd command-line-arguments command-prompt