private static string cmdFtp(string ip,string user,string password,string path,string lpath)
{
string rst = "";
Process p = new Process();
p.StartInfo.FileName = "cmd.exe";
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.CreateNoWindow = true;

p.Start();
p.StandardInput.WriteLine("cd " + lpath);
p.StandardInput.WriteLine("ftp " + ip);
p.StandardInput.WriteLine(user);
p.StandardInput.WriteLine(password);
p.StandardInput.WriteLine("cd " + path);
p.StandardInput.WriteLine("prompt off");
p.StandardInput.WriteLine("bin");
p.StandardInput.WriteLine("mput *.log");
p.StandardInput.WriteLine("bye");
p.StandardInput.WriteLine("del *.log");
p.StandardInput.WriteLine("exit");
rst = p.StandardOutput.ReadToEnd();
p.WaitForExit();
p.Close();
return rst;
}
请教:我这段代码是不正确的,但我不知道该怎么样修改,还请高手赐教。