xcopy 是否会暂停直到复制完成?
对于像这样的 C# 控制台应用程序,使用 xcopy 还是 robocopy 更好? 另外,xcopy 是否会暂停直到复制完成?
// copy web project to temp
Process proc = new Process();
proc.StartInfo.UseShellExecute = true;
proc.StartInfo.FileName = @"C:\WINDOWS\system32\xcopy.exe";
//proc.StartInfo.Arguments = @"C:\Users\Aron\Pictures\sql-help C:\temp\633965882226105579 /E /I";
proc.StartInfo.Arguments = string.Format("{0} {1} /E /I", TemplateDemoSiteFolder, SitePath);
proc.Start();
Thread.Sleep(9000); // pause for 9 seconds -not very safe though
For an C# console app like this is it better to use xcopy or robocopy?
Also, Does xcopy pause until copying is complete?
// copy web project to temp
Process proc = new Process();
proc.StartInfo.UseShellExecute = true;
proc.StartInfo.FileName = @"C:\WINDOWS\system32\xcopy.exe";
//proc.StartInfo.Arguments = @"C:\Users\Aron\Pictures\sql-help C:\temp\633965882226105579 /E /I";
proc.StartInfo.Arguments = string.Format("{0} {1} /E /I", TemplateDemoSiteFolder, SitePath);
proc.Start();
Thread.Sleep(9000); // pause for 9 seconds -not very safe though
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
而不是 Thread.Sleep();您可能想使用 proc.WaitForExit();
Instead of Thread.Sleep(); you probably want to use proc.WaitForExit();