c#中xcopy的进度报告 [英] Progress report of xcopy in c#
问题描述
System.Diagnostics.Process process = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
startInfo.FileName =cmd.exe;
startInfo.Arguments =/ c copy \ D:dfs.jpg C:dfee.jpg;
process.StartInfo = startInfo;
process.Start();
i想要计算c#UI的进度,使用进度条
谢谢
< blockquote>如果您在副本上使用/ z选项,它会向控制台屏幕报告进度百分比。
copy / z sourcefile.ext destfile.ext
您可以捕获文本输出并将其处理到您自己的进度条中,但没有整洁的方法来执行它 - 它不会调用委托人,或发出事件的信号,因为它是一个OC命令行操作,不打算在你的代码中使用。
System.Diagnostics.Process process = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
startInfo.FileName = "cmd.exe";
startInfo.Arguments = "/c copy \"D:dfs.jpg C:dfee.jpg";
process.StartInfo = startInfo;
process.Start();
i want to calculate the progress in c# UI ,using progress bar
Thanks
If you use the "/z" option on your copy, it reports percentage progress to the console screen.
copy /z sourcefile.ext destfile.extYou could capture the text output and process it into your own progress bar, but there is no "tidy" way to do it - it won't call a delegate, or signal an event because it's an OC command line operation, not intended to be used from your code.
这篇关于c#中xcopy的进度报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!