You have to put the
ftp commands to a separate file. You cannot put lines you otherwise type on terminal to
.bat file and expect it to behave identically. The
.bat file can include only Windows commands. When you run the
ftp command from the batch file, it waits for its commands. It does not know about the
.bat file, so it cannot read the commands from there.
So put your commands to a separate text file (e.g.
open 184.108.40.206 21
And run it from the
.bat file like:
If you really need to use a dynamic file name (from an environment variable), you need to create the text file on-the-fly. The
ftp does not support variables.
If you use a better FTP client, you might be able to both have the commands in the batch file and use the environment variables.
For example with WinSCP:
winscp.com /command ^
"open ftp://TESTA9MS:firstname.lastname@example.org" ^
"put ""%MyPath%""" ^
For an introduction to scripting with WinSCP see:
There's also a guide to Converting Windows FTP script to WinSCP script.
(I'm the author of WinSCP)