Pass arguments to ftp -s command
-
I have a file which I run with the
ftp
using the-s
switch in the Windows terminal. The file instruct the FTP-module to get a file from the FTP-server. I would like to specify the file as a parameter. Is this possible? For instance theinstructions.txt
"instructs" the FTP-command what to do:open ftp-server.com
name
password
get file.txtThen I run everything with this command:
ftp -s:instructions.txt
Can I pass the file name as a parameter instead of hard coding the file name in the
instructions.txt
? Best regards /Steffe -
I have a file which I run with the
ftp
using the-s
switch in the Windows terminal. The file instruct the FTP-module to get a file from the FTP-server. I would like to specify the file as a parameter. Is this possible? For instance theinstructions.txt
"instructs" the FTP-command what to do:open ftp-server.com
name
password
get file.txtThen I run everything with this command:
ftp -s:instructions.txt
Can I pass the file name as a parameter instead of hard coding the file name in the
instructions.txt
? Best regards /Steffe -
I have a file which I run with the
ftp
using the-s
switch in the Windows terminal. The file instruct the FTP-module to get a file from the FTP-server. I would like to specify the file as a parameter. Is this possible? For instance theinstructions.txt
"instructs" the FTP-command what to do:open ftp-server.com
name
password
get file.txtThen I run everything with this command:
ftp -s:instructions.txt
Can I pass the file name as a parameter instead of hard coding the file name in the
instructions.txt
? Best regards /SteffeAccording to
ftp -h
it is not posssible. But you can write a small batch / command file that does it for you:
@echo off
rem send-ftp.cmd: Upload file via FTP
if %1.==. goto err
echo open ftp-server.com > instructions.txt
echo name >> instructions.txt
echo password >> instructions.txt
echo get %1 >> instructions.txt
ftp -s:instructions.txt
goto end
:err
echo Missing file name parameter
:end -
According to
ftp -h
it is not posssible. But you can write a small batch / command file that does it for you:
@echo off
rem send-ftp.cmd: Upload file via FTP
if %1.==. goto err
echo open ftp-server.com > instructions.txt
echo name >> instructions.txt
echo password >> instructions.txt
echo get %1 >> instructions.txt
ftp -s:instructions.txt
goto end
:err
echo Missing file name parameter
:end