0

I'm using a .bat script to FTP a single text file. The .bat file code contains this code:

 ftp -s:FTPScript_Text.txt

And the text file FTPScript_Test with the FTP information looks like this:

 open myserver.com 21
 ftpuser
 ftppassword
 quote pasv
 cd incomingfiles
 put emptyfile.txt
 quit

The output from CMD looks like this:

 C:\Users\ks\Desktop>ftp -s:FTPScript_Text.txt
 ftp> open myserver.com 21
 Connected to myserver.com.
 220 Service ready for new user.
 530 Access denied.
 User (myserver.com:(none)):
 331 User name okay, need password for ftpuser.

 230 User logged in, proceed.
 ftp> quote pasv
 227 Entering Passive Mode (10,200,203,45,40,235)
 ftp> cd incomingfiles
 250 Directory changed to /incomingfiles
 ftp> put emptyfile.txt
 200 Command PORT okay.
 150 File status okay; about to open data connection.

And it stays on that "150 Status is okay...." line indefinitely. How long is this supposed to take? I figured this should take seconds or a couple minutes. I don't have many permissions to access that server itself and I think the firewall should be fine, because that server sometimes FTPs files to me...(I think). Or is there something wrong with the code or file paths?

EDIT: If this is a duplicate question, that other responder never addressed things like the following, where there is opinion that PASV mode is supported as long as its agreed upon by both client and server: https://community.hpe.com/t5/Operating-System-OpenVMS/Using-Windows-FTP-in-PASSIVE-mode/td-p/4989864#.XUwwB-hKhGM

(from the last post of that link..."1) Windows FTP does seem to support Passive mode. In fact, there is a Windows Registry item for FTP "use PASV yes", so FTP seems to default to passive mode."

enter image description here

PBJ
  • 354
  • 2
  • 15
  • 1
    *"1) Windows FTP does seem to support Passive mode. In fact, there is a Windows Registry item for FTP "use PASV yes", so FTP seems to default to passive mode."* – I'm quite confident that that quote is a total nonsense. That registry value if for Internet Explorer (it's possible that it's what the author means by "Windows FTP"). And if you really believe that post, did you try it? – Martin Prikryl Aug 08 '19 at 14:41
  • Martin, thanks for the comment, Yes, I tried passive mode in the above code, and it appears to have worked given that the response indicates it worked. If it only looks like it worked, but didn't, then I would like to know more about why it's very confusing. – PBJ Aug 08 '19 at 15:04
  • And again how long does this FTP process take? Seconds or a minute? Could it take 30 minutes and it actually is working? (it's just one file) – PBJ Aug 08 '19 at 15:06
  • 1
    I've meant if you have tried the "use PASV yes" – You never wrote about `quote pasv` before. But that does NOT work for sure. I have addressed that in [How to use passive FTP mode in Windows command prompt?](https://stackoverflow.com/q/18643542/850848) – Martin Prikryl Aug 08 '19 at 15:12
  • Oh ok...now I am understanding the difference between windows not supporting passive mode (for a connected server), and not supporting being itself *in* passive mode, when it's the agreement between both that is needed. I'm still confused because there are other files being FTP'd here at my location that seem to be effectively equivalent to my script, and work fine (I don't have access to the bat files but the scripts look the same from what I can see). The FTP experts here are insisting this works for them & their apps work. I'm clearly missing something & will post an answer when I find out! – PBJ Aug 08 '19 at 19:41
  • What does it mean *"effectively equivalent"*? Do they use `ftp.exe` or not? If they use `ftp.exe`, do they run it on the same machine as you? – Martin Prikryl Aug 08 '19 at 19:52
  • By "effectively" the same, I mean doing the same general tasks (yes, ftp.exe), with the same properties (connections, ports, quote pasv...), files are formatted like mine so that I can't differentiate the difference between their files and mine...except that some credentials/passwords are different and no, we are not running it on the same machine. So, I've asked some other folks to verify that they're running their scripts on Windows (as opposed to Linux...although I was told they're indeed .bat files), and that they're not running other programs alongside this to help. – PBJ Aug 09 '19 at 00:45
  • The other machine may have firewall configured to allow the incoming active data connections. – Martin Prikryl Aug 09 '19 at 06:23

0 Answers0