By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,264 Members | 1,755 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,264 IT Pros & Developers. It's quick & easy.

How to not-quite-automate an FTP in WinXP

Expert 5K+
P: 8,434
Hi all.

If necessary I'll repost this in the Windows forum, but I thought this would be a good place to hit a fair cross-section of the community. Besides, anyone can see that all the best brains post here. ;-)

I have a bit of a problem with scripting an FTP under Windows XP, and was hoping someone can shed some light on it.

I'm quite familiar with DOS batch files, and reasonably comfortable with FTP. I have a bunch of files that I generally download to my PC each morning. I generally start by copying a bunch of commands from a text file to the clipboard, then fire up the vanilla Windows FTP client and manually log on to the FTP server. Then I paste, sit back and watch the show.

So far, so good.

But I'm going on leave for a few weeks, and need to automate the process for someone else to run while I'm away, as some of the files will be deleted before I get back. I can set up a batch file they can open to FTP to the appropriate server and run a script, no worries.

BUT!!!

How can I allow the user to provide their user ID and password to log on? Hard-coding either mine or theirs into the file is out of the question. I have tried all sorts of combinations of auto-logon turned on and off, user and pass commands in the script file, and so on. But it seems as though I can basically either code the details in the file, or make the user do everything.

I need a way to let the FTP server stop and prompt the user (as normal) for their password (and maybe ID, but that's not so important) before continuing with the script.

If necessary, I'll write up instructions for them to paste the commands across like I've been doing, but would really prefer to automate it.

TIA

Tagline: I never muss the obvious.
Nov 28 '06 #1
Share this Question
Share on Google+
10 Replies


NeoPa
Expert Mod 15k+
P: 31,662
Killer,

I've done lots of work in this area but I'm on holiday tomorrow and my link into the office is down.
Mostly I've automated it fully though, rather than allowing creds to be entered.

For the full SP on the FTP command, though, go to Windows Explorer (Windows-E) and select 'Help and Support centre' from the Help menu.
In there search for FTP & select the option FTP from the found list.
There's not much it doesn't tell you.

Best of luck and let me know if you're still having problems on Thursday.

-Ade.
Nov 28 '06 #2

Expert 5K+
P: 8,434
I've already checked the doco for FTP. Automating it is easy. The problem is that there is part of the process that I don't want to automate, as I still need to leave the security intact.

P.S. I've also searched Microsoft's website, thescripts, and a general Google search, without success.
Nov 28 '06 #3

NeoPa
Expert Mod 15k+
P: 31,662
I've already checked the doco for FTP. Automating it is easy. The problem is that there is part of the process that I don't want to automate, as I still need to leave the security intact.

P.S. I've also searched Microsoft's website, thescripts, and a general Google search, without success.
Ok ok - I still need my head - don't bite it off.
I did read the original post but hadn't realised you'd checked into it that far already.
I can maybe do some more testing if I get time on Thursday for you.
Nov 28 '06 #4

Expert 5K+
P: 8,434
Ok ok - I still need my head - don't bite it off.
I did read the original post but hadn't realised you'd checked into it that far already.
I can maybe do some more testing if I get time on Thursday for you.
Cool, thanks. I've still got a couple of weeks.

And I wasn't intending to be snappy. :-(

I did forget to mention that I'd searched all over the place.
Nov 29 '06 #5

NeoPa
Expert Mod 15k+
P: 31,662
You know that's not a problem Killer - I was just having some fun ;).
Nov 29 '06 #6

NeoPa
Expert Mod 15k+
P: 31,662
Killer,

I have a command file (D:\Vecta\VectaBeta.Cmd) which executes the FTP job.
Expand|Select|Wrap|Line Numbers
  1. FTP.Exe -n -s:D:\Vecta\VectaBeta.Ftp -w:16384 blinnk.net
I have this scheduled in the last step of my SQL Server job which produces the data file.
Expand|Select|Wrap|Line Numbers
  1. At 19:00 "D:\Vecta\VectaBeta.Cmd"
The job itself (D:\Vecta\VectaBeta.Ftp) includes the connection security information.
Expand|Select|Wrap|Line Numbers
  1. user {LogonID} {Password}
  2. binary
  3. lcd D:\MSSQL\Backup
  4. delete StatPlusVecta.Zip
  5. bell
  6. put StatPlusVecta.Zip
  7. delete VectaSTP.Bak
  8. bell
  9. put VectaSTP.Bak
  10. bye
I'm pretty sure that this will prompt you for information if you either don't pass the complete set of creds or if you don't include the 'user' line at all.
Dec 5 '06 #7

sashi
Expert 100+
P: 1,754
Hi Killer,

I came across few links that deals with FTP scripts, kindly refer to below attached links, hope it provides some solutions. Goos luck & Take care.

http://support.microsoft.com/kb/96269
http://www.simotime.com/ftp4cmd1.htm
http://www.ericphelps.com/batch/samples/samples.htm
FTP - Script
Dec 5 '06 #8

Expert 5K+
P: 8,434
...
I'm pretty sure that this will prompt you for information if you either don't pass the complete set of creds or if you don't include the 'user' line at all.
What I've found is that rather than stopping to prompt the user, it simply takes the next piece of info from the file.

So basically, I can either automate if fully by sticking a user ID and password in the file (ugh!), or I can make the user drive it themselves, but can't seem to combine the two.

Thanks, anyway. I'll check out sashi's links, but so far things are not looking promising.
Dec 5 '06 #9

Expert 5K+
P: 8,434
...I came across few links that deals with FTP scripts...
Thanks, sashi - I'll check them out.
Dec 5 '06 #10

Expert 5K+
P: 8,434
Thanks, sashi - I'll check them out.
Well, I've had a look.

As I suspected, there's a lot of fascinating info there (now bookmarked for later reading), but not what I was looking for.

I don't think it's possible. All samples and explanations assume that by scripting, you will want to automate the logon by including user ID and password in the script. Argh!

The batch file which accepts user input to an environment variable looked like a chance, until I tried it out and found that it doesn't work under XP. (At least, I assume XP was the problem - it looks as though FC now refuses to accept CON as an input file.)

Thanks everyone, but I might as well give up on that line of attack - I have to have this working in a couple of days. Think I'll just set up instructions for the user to log on, then copy and paste the command stream.
Dec 5 '06 #11

Post your reply

Sign in to post your reply or Sign up for a free account.