CCNet.Common.Helpers.ServiceHelper.CreateCustomProcess C# (CSharp) Method

CreateCustomProcess() private static method

Creates process with custom settings.
private static CreateCustomProcess ( string command, string arguments, bool runAsAdministrator = false ) : Process
command string
arguments string
runAsAdministrator bool
return System.Diagnostics.Process
		private static Process CreateCustomProcess(
			string command,
			string arguments,
			bool runAsAdministrator = false)
		{
			Process p = new Process();

			p.StartInfo.FileName = command;
			p.StartInfo.Arguments = arguments;
			p.StartInfo.CreateNoWindow = true;
			p.StartInfo.UseShellExecute = runAsAdministrator;
			p.StartInfo.RedirectStandardOutput = !runAsAdministrator;
			p.StartInfo.RedirectStandardInput = !runAsAdministrator;
			p.StartInfo.RedirectStandardError = !runAsAdministrator;
			if (runAsAdministrator)
			{
				//xxx discuss the right option
				//p.StartInfo.Verb = "runas";
			}

			return p;
		}
	}