0

I´d like to make Windows .cmd script file. One of its commands makes use of the ftp command. When I execute the batch script, the commmand prompt does not wait for the user to type his user/password, so the next commands are not properly executed. How can I make it to pause?

Thanks.

Edited:

My question was more related to the interactive use of the command (-i option) than the automatic login (-n option). I want to wait for the user to enter their credentials.

Also, I have seen that by typing the command:

ftp -n -i -s:myFtpCommands.txt 192.168.0.20

and that myFtpCommands.txt contains:

use myUser
mget *
bye

There is no need to type the password to get files. Where is the associated security problem?

1
  • learn to ask your commands for what they can do, i.e. ftp /help will show the possibilities. I'm thinking -n may help. Else you should post the minimal section of your script that will demonstrate your problem. Good luck. Commented Jan 24, 2013 at 17:59

1 Answer 1

1

You could ask the user for their details before hand, then build the command file based on their input.

@echo off
set /p un=Enter your FTP username:
set /p pw=Enter your FTP password:
echo open 192.168.0.20 >ftpscript.txt
echo %un% >>ftpscript.txt
echo %pw% >>ftpscript.txt
mget * >>ftpscript.txt
bye >>ftpscript.txt
ftp -i -s:ftpscript.txt

With regards to the auto login, this is a feature of FTP, it's an anonymous login, that is setup on FTP servers to allow this sort of access.

Whoever setup the FTP server would be able to control the accounts that are allowed to be used to access the server, and the permissions on the files that they don't want everyone to have access to.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.