I have a problem, I use Process.Start to launch an executable, although is it possible to say: if input.txt == 0kb do nothing, else e开发者_开发问答xecute process ?
Process.Start("cmd.exe", @"/c test.exe -f input.txt > output.txt").WaitForExit();
Use FileInfo
to get the size of the input file and only run the process if it is larger than 0:
FileInfo fi = new FileInfo("input.txt");
if(fi.Length > 0)
{
Process.Start("cmd.exe", @"/c test.exe -f input.txt > output.txt").WaitForExit();
}
精彩评论