Do you want this done client-side, or server-side?
If client-side, not possible. Think about this logically. Can you imagine the chaos that would ensue if every site were able to write and execute batch scripts on your machine? Besides, the code wouldn't work on every machine even if it weren't a massive security risk. For example, machines running the bash shell wouldn't be able to make head nor tail of most of the constructs of DOS scripting -- bash has its own (far superior) scripting language.
If server-side, it is possible, though the batch file isn't really needed. As you didn't specify a language, I'll write an example in PHP. Note that I've still used your idea of executing the external ftp.exe program, although PHP provides better ways of handling FTP resources.
$otter = 'username' . "\r\n" .
'password' . "\r\n" .
'bye' . "\r\n";
$sealion = fopen('C:\test.txt', 'w');
shell_exec('ftp -s C:\test.txt');