我有一个问题,我可以使用Process.Start启动可执行文件,尽管可以这样说:如果input.txt == 0kb不执行任何操作,否则执行进程?
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();
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.