views:

79

answers:

1

I'm writing a fairly simply script and I'm trying to upload a file to an ftp server. I'm using the following command

ftp -n -s:upload.txt 292.78.51.12 (I've faked the IP)

It works perfectly in command prompt but it seems to have a problem with it in powershell. I've tried giving the absolute path to upload.txt, put .\ before it and nothing seems to work.

Any idea what I'm doing wrong?

+2  A: 

You need to put quotes around "-s:upload.txt". I believe it has something to do with the colon in the option. If anyone could clarify why that would be great.

Robert
Thanks, works perfectly now
Chris McGrath
It appears to be the case in PowerShell v1, though not in v2 (which is why I had a hard time here reproducing that issue -.-). No idea why, though.
Joey
They changed how they parse/send parameters to native EXEs. In V1, exe sees arg1=-s: arg2=upload.txt. In V2, the exe sees arg1=-s:upload.txt. In V1, quoting the entire argument fixes this issue.
Keith Hill