Frage

Für eine C # Konsole App wie diese ist es besser zu Einsatz xcopy oder robocopy? Auch dann, wenn xcopy Pause, bis der Kopiervorgang abgeschlossen?

// 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
War es hilfreich?

Lösung

Statt Thread.Sleep (); Sie wollen wahrscheinlich proc.WaitForExit () verwenden;

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top