我有一个问题,我使用Process.Start来启动可执行文件,虽然可以说:如果input.txt == 0kb什么也不做,否则执行进程?
Process.Start("cmd.exe", @"/c test.exe -f input.txt > output.txt").WaitForExit();
Run Code Online (Sandbox Code Playgroud)
使用FileInfo来获取输入文件的大小,只运行过程中,如果它是大于0:
FileInfo fi = new FileInfo("input.txt");
if(fi.Length > 0)
{
Process.Start("cmd.exe", @"/c test.exe -f input.txt > output.txt").WaitForExit();
}
Run Code Online (Sandbox Code Playgroud)