开发者

Passing Parameters/Argument to FTP filename from DOS

I am calling a FTP file from DOS, which holds ftp set of commands as follows:

ftp -s:ftpcmd1.txt

Now, the change requirement says, file is to be called multiple times with different file paths.

so, I need to write above statement, each time passing new file path as argument with FTP filename and writing something like "%1" in command inside ftp-file. Please help me with same.开发者_如何学JAVA How do I do it.

Thanks.


I dont know if we can pass parameter to ftp script (atleast in DOS). But in the above case dynamically written out ftp script file would help. Small bat file which would do that is like below.

echo "user username pwd">ftpcmd1.txt
echo "bin">>ftpcmd1.txt
echo "put %1">>ftpcmd1.txt
echo "bye">>ftpcmd1.txt
ftp -n -i -v servername<ftpcmd1.txt

If you call this bat file with any file name as the first command line argument, it would transfer the file to target servername. Hope this is what you are looking for.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜