Public class form1 <br/> private sub into trans_click (byval sender as system. object, byval e as system. eventargs) handles implements trans. click <br/> dim PSI as new system. diagnostics. processstartinfo <br/> dim ftpfilename as string </P> <p> psi. filename = "ftp.exe" <br/> psi. redirectstandardinput = false <br/> psi. redirectstandardoutput = true <br/> psi. useshellexecute = false </P> <p> ftpfilename = "E:/ftp.txt" <br/> psi. arguments = "-S:" & ftpfilename </P> <p> dim proc as Process <br/> proc = process. start (PSI) <br/> 'wait Process <br/> Proc. waitforexit () <br/> console. writeline (Proc. standardoutput) <br/> console. readline () <br/> end sub <br/> end class <br/>
Content in ftp.txt:
Open 192.168.1.110
User dumeifang
Put E:/ip.html
Quit
Console output:
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
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: Send 1672 bytes, 0.00 seconds 1672000.00 Kbytes/sec.
Ftp> quit
221 goodbye, closing session.
FTP-S: filename is to write some FTP commands into filename, and FTP automatically runs the content