AlexPawlak
AlexPawlak

Reputation: 799

FTP script Windows invalid command character appended?

I am trying to figure out what is wrong in my script. I am trying to automate the task of getting data from many FTP servers, using PowerShell as scripting environment.

I am using

ftp.exe -n -s:Script.txt $SOMEIp

It was giving me output:

Connected to 10.128.10.195.
220 Service ready
User(10.128.10.195:(none)):
530 Invalid user
Login failed.

I tried some troubleshooting by experiencing with the script and so on - the initial result is that FTP Error

Is the "rectangle" char appending "a" character causing this or what is exactly wrong with the script?

In any case:

admin
password
cd ...
ascii
get somefile.txt
quit

is the script, while command to execute it, as I mentioned,

ftp.exe -n -s:Script.txt $SOMEIp

On the PNG file you see some troubleshooting file, where I tried to "ignore" the first wrong line and then restart with user and password prompt.

Would be great if you could share some ideas on that matter.

Cheers

Alex

Upvotes: 1

Views: 3745

Answers (2)

dan-gph
dan-gph

Reputation: 16909

Try saving your Script.txt as ASCII or ANSI. It could be that your ftp client doesn't understand unicode.

Upvotes: 1

Mark Setchell
Mark Setchell

Reputation: 207465

Try changing your script to this:

user admin password
cd ..
ascii
get somefile.txt
quit

You need to tell the FTP server that what is coming is the username and password. Also, you need two dots not three to go up a level.

Upvotes: 0

Related Questions