Public Class Form1
Private Sub CmdTrans_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles CmdTrans.Click
Dim psi As New System.Diagnostics.ProcessStartInfo
Dim ftpFileName As String
psi.FileName = "ftp.exe"
psi.RedirectStandardInput = False
psi.RedirectStandardOutput = True
psi.UseShellExecute = False
ftpFileName = "E:/ftp.txt"
psi.Arguments = "-s:" & ftpFileName
Dim proc As Process
proc = Process.Start(psi)
'Wait process
proc.WaitForExit()
Console.WriteLine(proc.StandardOutput)
Console.ReadLine()
End Sub
End Class
open 192.168.1.110
user dumeifang dumeifang
put E:/ip.html
quit
控制台中的输出:
ftp> open 192.168.1.110
Connected to 192.168.1.110.
220 Serv-U FTP Server v8.2 ready...
User (192.168.1.110:(none)):
530 Invalid user name.
Login Failed.
ftp> user dumeifang dumeifang
331 User name okay,need password.
230 User logged in,proceed.
ftp> put E:/ip.html
200 PORT Command successful.
150 opening ASCII mode data connection for ip.html.
226 Transfer complete. 1,672 bytes transferred. 1.63 KB/sec.
ftp: 发送 1672 字节,用时 0.00Seconds 1672000.00Kbytes/sec.
ftp> quit
221 Goodbye,closing session.
ftp -s:filename是把一些ftp的命令写入filename中,FTP自动运行里面的内容
总结
如果觉得编程之家网站内容还不错,欢迎将编程之家网站推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。