我有以下批处理脚本到 FTP 并从主机拉回文件。(ftpscript.bat)
@echo off
@ftp -i -s:"%~f0"&GOTO:EOF
open host1
username
password
cd apples
bin
hash
get fileName.txt fileName.host1
disconnect
我有以下包含主机列表的文本文件。(hosts.txt)
host1
host2
host3
host4
如何遍历文件中的每个主机,文件的每一行,并在其中运行带有主机变量的脚本?
这是我希望它在运行时的样子的示例:
@echo off
@ftp -i -s:"%~f0"&GOTO:EOF
open host1
username
password
cd apples
bin
hash
get fileName.txt fileName.host1
disconnect
open host2
username
password
cd apples
bin
hash
get fileName.txt fileName.host2
disconnect
open host3
username
password
cd apples
bin
hash
get fileName.txt fileName.host3
disconnect
open host4
username
password
cd apples
bin
hash
get fileName.txt fileName.host4
disconnect