开发者

Does xcopy pause until copying is complete?

For an C# console app like this is it better to use xcopy or robocopy? Also, Does xcopy pause until copying is complete开发者_StackOverflow中文版?

// 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


Instead of Thread.Sleep(); you probably want to use proc.WaitForExit();

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜