Trouble with ftp batch file.

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
paperbag
Posts: 4
Joined: 09 Dec 2011 04:03

Trouble with ftp batch file.

#1 Post by paperbag » 09 Dec 2011 04:08

I made a bact file for the ease of using ftp.exe through cmd prompt.

@echo off
echo user username> ftpcmd.dat
echo pasword>> ftpcmd.dat
echo bin>> ftpcmd.dat
echo put %1>> ftpcmd.dat
echo quit>> ftpcmd.dat
ftp -n -s:ftpcmd.dat server
del ftpcmd.dat

it works on some machines, but on others i get this error.

< was unexpected at this time.
C:\WINDOWS\system32><html><head><meta http-equiv="refresh" content="0;url=http://search.suddenlink.net/index.php?origURL=http://hiddenforprivacyiaddedthis"/></head><body><script>window.location="http://search.suddenlink.net/index.php?origURL="+escape(

i don't understand what is going on. any help wouldbe awesome.
thi s error is coming from a xp sp3 machine.

paperbag
Posts: 4
Joined: 09 Dec 2011 04:03

Re: Trouble with ftp batch file.

#2 Post by paperbag » 09 Dec 2011 17:57

i can't figure out why this error is happening.

orange_batch
Expert
Posts: 442
Joined: 01 Aug 2010 17:13
Location: Canadian Pacific
Contact:

Re: Trouble with ftp batch file.

#3 Post by orange_batch » 09 Dec 2011 19:06

Are you trying to copy an HTML file? Try copying in binary mode instead of ASCII. I don't know why a file transfer would be processed through the command interpreter, but it seems you're encountering a < at +escape(< in an HTML file.

paperbag
Posts: 4
Joined: 09 Dec 2011 04:03

Re: Trouble with ftp batch file.

#4 Post by paperbag » 09 Dec 2011 20:01

It's a jpg file. Im running it in binary mode i think.. I was hoping this code "echo bin>> ftpcmd.dat" put it in binary mode. thanks.

orange_batch
Expert
Posts: 442
Joined: 01 Aug 2010 17:13
Location: Canadian Pacific
Contact:

Re: Trouble with ftp batch file.

#5 Post by orange_batch » 09 Dec 2011 20:26

Is there more to your script? What you've given doesn't have any indication of being problematic.

paperbag
Posts: 4
Joined: 09 Dec 2011 04:03

Re: Trouble with ftp batch file.

#6 Post by paperbag » 10 Dec 2011 00:38

naw thre is nothing else.

i runt it b typing

ftile up file name

dbenham
Expert
Posts: 2461
Joined: 12 Feb 2011 21:02
Location: United States (east coast)

Re: Trouble with ftp batch file.

#7 Post by dbenham » 10 Dec 2011 07:37

Things to check.

1) Verify you do not have an ftp.bat anywhere in your PATH on the machine that is failing.

2) Is the error message you posted related to the contents of the file you are attempting to upload? It looks like you tried to upload an HTML file and somehow Windows is trying to interpret the contents as batch commands. There is nothing in the code (pseudo code?) that you posted that should cause this.

Dave Benham

Post Reply