First create your command in any variable..
Create a method which execute this command on the server.
- Process commandProcess = null;
-
-
- public bool ExecuteCommand(string curlExePath, string commandLineArguments, bool isReturn = true)
- {
- bool result = true;
- try
- {
- commandProcess = new Process();
- commandProcess.StartInfo.UseShellExecute = false;
- commandProcess.StartInfo.FileName = curlExePath;
- commandProcess.StartInfo.Arguments = commandLineArguments;
- commandProcess.StartInfo.CreateNoWindow = true;
- commandProcess.StartInfo.RedirectStandardInput = true;
- commandProcess.StartInfo.RedirectStandardOutput = true;
- commandProcess.StartInfo.RedirectStandardError = true;
- commandProcess.Start();
- var reader = new ProcessOutputReader(commandProcess);
- reader.ReadProcessOutput();
- commandProcess.WaitForExit();
- string output = reader.StandardOutput;
- lastStandardOutput = output;
- string error = reader.StandardError;
- commandProcess.Close();
- }
- catch(exception ex)
- {
- }
- }