public async Task Run() { var process = new WinProcess("robocopy"); if (outputToConsole) { process.WriteOutputToConsole(); } process .UseArgumentNameDelimiter("") .AddArgument(new Quoted(source)) .AddArgument(new Quoted(target)) .AddArgument(pattern) .UseArgumentNameDelimiter("/") .UseArgumentValueDelimiter(":") .SetWorkingDirectory(workingDirectory); foreach (var arg in options) { process.AddArgument(arg); } if (attributesToAdd.Any()) { process.AddArgument("a+", string.Join("", attributesToAdd)); } var result = await process.Run(); if (result.ExitCode >= 8) { throw new Exception($"robocopy failed with exit code {result.ExitCode}"); } }
private WinProcess createProcess() { var process = new WinProcess("psexec"); if (outputToConsole) { process.WriteOutputToConsole(); } process.UseArgumentNameDelimiter(""); process.AddArgument(server); process.AddArgument(remoteProcess.CommandText()); return(process); }
private WinProcess createProcess() { var process = new WinProcess("cmd"); process.SetWorkingDirectory(workingDirectory); if (outputToConsole) { process.WriteOutputToConsole(); } process.UseArgumentNameDelimiter("/"); process.AddArgument("C"); process.UseArgumentNameDelimiter(""); process.AddArgument(otherProcess.CommandText()); return(process); }
private WinProcess createWinProcess() { var process = new WinProcess(fileName); if (outputToConsole) { process.WriteOutputToConsole(); } process.UseArgumentNameDelimiter("--"); process.UseArgumentValueDelimiter(" "); process.AddArgument("environment", environment.Value); process.SetWorkingDirectory(workingDirectory); var dict = config.ToDictionary(); foreach (var key in dict.Keys) { process.AddArgument(key, new Quoted(dict[key])); } return(process); }