Share via


FTP BAT: worked in Win 7 but not in Win 10

Question

Tuesday, October 11, 2016 5:22 PM

Hello,

First let me say that any information I don't provide, I'll be happy to provide.

I created simple batch files to upload/download files to my FTP based on scheduled tasks. The schedule part is not a concern for this request, getting the FTP to function again is the topic. I created them years ago in Windows 7. I have a .bat that calls the .txt with the script in it to open the FTP site, browse to the directory, download all contents to a local folder, then disconnect.

Another variation connects, deletes everything on the remote server, then uploads everything in the local directory to the remote server.

These are functioning still when ran/scheduled on Windows 7. When invoked or scheduled in Windows 10, they do not work. I have tried many things, when I run the commands line by line in an elevated CMD, the delete commands (mdelete *.*) gets the following:

ftp> mdelete *.*
PORT/EPRT (Active Mode/Extended Active Mode) is not supported. Use PASV/EPSV instead of this
200 TYPE is now ASCII
Cannot find list of remote files.

If I set it to ascii first, then invoke mdelete *.*   I get:

ftp> mdelete *.*
200 TYPE is now ASCII
Cannot find list of remote files.

I have checked that my workstation is Windows 10 pro, has TFTP enabled and the FTP server itself is on and functioning. When I run this .bat from the Windows 7 workstation, it runs correctly and deletes everything as intended. Here is the complete script, having replaced my domain name & passwords for obvious reasons.

.BAT FILE CONTAINS:
ftp -s:"T:\Air-Car-Hotel\PDF_Files\Invoices\Delete_Invoices.txt"

DELETE_INVOICES.txt CONTAINS:
open domain.com
username
CleverPassword
ha
cd /public_html/Invoices
binary
prompt n
mdelete *.*
close
quit
The goal for this batch file is two: 1) schedule it to run every hour and 2) for my staff to be able to run it on-demand when necessary.
I am speculating that Windows 10 has enabled something by default that is either blocking this from functioning, either a port (I doubt this) or a feature for scripts to run on network shares...where Windows 7 did not have this. Or that Windows 10 commands are different and mdelete is deprecated? Any help is greatly appreciated!

Thank you,
John

John Fester

All replies (6)

Thursday, October 13, 2016 8:01 AM ✅Answered

Hi omega4alpha,

Try to turn off the firewall and the antivirus software temporarily to have a test.

Best regards

Please remember to mark the replies as an answers if they help and unmark them if they provide no help.
If you have feedback for TechNet Subscriber Support, contact [email protected]


Tuesday, October 11, 2016 7:54 PM

in the ftp connection manager, make sure ‘Use Passive Mode’ checkbox is checked.


Tuesday, October 11, 2016 8:17 PM

in the ftp connection manager, make sure ‘Use Passive Mode’ checkbox is checked.

Hi Mel_W, I appreciate the response, but unless I've missed something, I believe you are mistaken considering I am not using a connection manager. I stated that this is a batch file script running the FTP.

Let me also add for everyone the fact that any FTP program (filezilla is my flavor) works flawlessly to upload, download, delete and delete recursively. I am using the same account for the script. I am happy to provide screenshots of my site manager for that FTP from filezilla, or type the settings. The one I believe is associated with this is the Transfer Mode, which is set to Default (I believe default with filezilla is Active).

John Fester


Wednesday, October 12, 2016 7:42 PM

Does it still have this problem if you use .cmd file extension instead of .bat?


Wednesday, October 12, 2016 8:07 PM

Does it still have this problem if you use .cmd file extension instead of .bat?

I just tried that, and same results. However, let me point out what I mentioned that the error is generated when I run it in an elevated CMD. So the file type calling the script cannot be the cause.

John Fester


Thursday, October 13, 2016 12:17 PM

Hi omega4alpha,

Try to turn off the firewall and the antivirus software temporarily to have a test.

Best regards

Please remember to mark the replies as an answers if they help and unmark them if they provide no help.
If you have feedback for TechNet Subscriber Support, contact [email protected]

Hi MeipoXu, that worked! I run Kaspersky Internet Security and disabling it did the trick. I'm speculating that also Windows Firewall/Defender do this as well, because on the other Windows 10 machine I tested it from, does not have Kaspersky, only Defender with Windows Firewall. I'll try on that one also to disable the firewall/AV and see if it works there as well.

Thank you again!

John Fester