private static void InvokeScript(int arguments) { Process p = new Process(); p.StartInfo.FileName = "powershell.exe"; p.StartInfo.Arguments = String.Format("{0}\"\"{1}\"\"", update, arguments); p.StartInfo.RedirectStandardOutput = true; p.StartInfo.RedirectStandardError = true; p.StartInfo.UseShellExecute = false; p.Start(); var output = p.StandardOutput; var error = p.StandardError; string result = output.ReadToEnd(); string errorstring = error.ReadToEnd(); p.WaitForExit(); }
private const string update = @" try { return $($args.count) } catch { return $_.Exception.Message }";
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)