First create your command in any variable..
- -T "d:\myfile.txt" ftp://username:[email protected] -k --ftp-ssl
- 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; // this is the path of curl where it is installed;
- commandProcess.StartInfo.Arguments = commandLineArguments; // your curl command
- 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)
- {
- }
- }
