1

So I'm trying to do something like this:

ftp my.ip.add.ress(user id)(password)cd /the/directorysend C:/code/project1/*bye

I know you can send Windowsftp commands through the command line when you first start it like-send, but the question is can I use a .bat script to act interactively with the program it starts? By default what happens is the first line:

ftp my.ip

Starts ftp, but the subsequent lines never run untilftp exits.

edit

Another way to phrase this question is "Is it possible to use a .bat file to queue lines of text to feed tostdin whenstdin is next checked for input?"

askedDec 14, 2010 at 17:07
bobobobo's user avatar

1 Answer1

2

As far as I know, the command shell is not multi-threaded, so there is no way for a batch to continue executing while another interactive shell program is executing within it.

You need to move the FTP commands into their own file, and pass that to the FTP program so it can run them as its own internal script.

ftp -s:filename

Specifies a text file containing FTP commands; the commands will run automatically after FTP starts.

answeredDec 14, 2010 at 17:10
jball's user avatar
Sign up to request clarification or add additional context in comments.

2 Comments

This answers the specific case offtp, however I'm curious about whether or not its possible to "queue" things in stdin as it were from a .bat file -
The queue would have to have some way to discriminate when it should and shouldn't feed the next line to stdin. Given that at least some shell programs can continuously accept input, I don't think there's a way around requiring that programs internalize their own batch processing methods (e.g. passing a file to FTP).

Your Answer

Sign up orlog in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

By clicking “Post Your Answer”, you agree to ourterms of service and acknowledge you have read ourprivacy 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.