Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 help and support Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.


Go Back   Vista Forums > Vista Newsgroup Archive > Misc Newsgroups > PowerShell

RB

Vista - FTP Script

 
 
11-15-2006   #1 (permalink)
JakeDAHS


 

FTP Script

After 10 minutes of frustration in ps, found the script I was using
works just as it should in cmd.exe possibly something with the
paramters?

an overview of a ftp script http://support.microsoft.com/kb/96269

works ok
CMD - ftp -s:ftpcommands.txt
-------------------------------------------
throws up help for the ftp.exe
PS - ftp -s:ftpcommands.txt
-------------------------------------------
-------------------------------------------
throws up help for the ftp.exe (expected)
CMD - C:\>ftp -s:
-------------------------------------------
a different type of error (from powershell and not ftp.exe?)
PS C:\> ftp -s:
Parameter -s: requires an argument.
At line:1 char:7
+ ftp -s: <<<<


My System SpecsSystem Spec
11-15-2006   #2 (permalink)
Marty List


 

Re: FTP Script


Seems like a bug to me, but try putting the parameters inside quotes:
ftp.exe '-s:ftpcommands.txt'
ftp.exe "-s:ftpcommands.txt"

or use a backtick escape character (under the ~tilde):
ftp.exe `-s:ftpcommands.txt



"JakeDAHS" <jskiba99@gmail.com> wrote in message
news:1163620805.275275.156820@b28g2000cwb.googlegroups.com...
> After 10 minutes of frustration in ps, found the script I was using
> works just as it should in cmd.exe possibly something with the
> paramters?
>
> an overview of a ftp script http://support.microsoft.com/kb/96269
>
> works ok
> CMD - ftp -s:ftpcommands.txt
> -------------------------------------------
> throws up help for the ftp.exe
> PS - ftp -s:ftpcommands.txt
> -------------------------------------------
> -------------------------------------------
> throws up help for the ftp.exe (expected)
> CMD - C:\>ftp -s:
> -------------------------------------------
> a different type of error (from powershell and not ftp.exe?)
> PS C:\> ftp -s:
> Parameter -s: requires an argument.
> At line:1 char:7
> + ftp -s: <<<<
>



My System SpecsSystem Spec
11-15-2006   #3 (permalink)
JakeDAHS


 

Re: FTP Script

Good call, thought I had tried with quotes before but just around the
script filename. each of your answers worked properly.

Thanks
-J



Marty List wrote:
> Seems like a bug to me, but try putting the parameters inside quotes:
> ftp.exe '-s:ftpcommands.txt'
> ftp.exe "-s:ftpcommands.txt"
>
> or use a backtick escape character (under the ~tilde):
> ftp.exe `-s:ftpcommands.txt
>
>
>
> "JakeDAHS" <jskiba99@gmail.com> wrote in message
> news:1163620805.275275.156820@b28g2000cwb.googlegroups.com...
> > After 10 minutes of frustration in ps, found the script I was using
> > works just as it should in cmd.exe possibly something with the
> > paramters?
> >
> > an overview of a ftp script http://support.microsoft.com/kb/96269
> >
> > works ok
> > CMD - ftp -s:ftpcommands.txt
> > -------------------------------------------
> > throws up help for the ftp.exe
> > PS - ftp -s:ftpcommands.txt
> > -------------------------------------------
> > -------------------------------------------
> > throws up help for the ftp.exe (expected)
> > CMD - C:\>ftp -s:
> > -------------------------------------------
> > a different type of error (from powershell and not ftp.exe?)
> > PS C:\> ftp -s:
> > Parameter -s: requires an argument.
> > At line:1 char:7
> > + ftp -s: <<<<
> >


My System SpecsSystem Spec
11-15-2006   #4 (permalink)
Adam Milazzo


 

Re: FTP Script

Marty List wrote:
> Seems like a bug to me, but try putting the parameters inside quotes:
> ftp.exe '-s:ftpcommands.txt'
> ftp.exe "-s:ftpcommands.txt"
>
> or use a backtick escape character (under the ~tilde):
> ftp.exe `-s:ftpcommands.txt


PowerShell's parser is a bit different than CMD.exe's. Which is good in
some ways, because CMD.exe's was pretty nasty.

I think they'll tell you it's a feature rather than a bug, but I agree
it can be unintuitive to people expecting things to "just work". :-)
My System SpecsSystem Spec
11-17-2006   #5 (permalink)
Alex K. Angelopoulos [MVP]


 

Re: FTP Script

Concurring with Adam, the issue here is the way PowerShell parses and
reassembles command lines before passing them to external commands.

It works fine with correctly-specified getopt() style options, but breaks
any getopt style option specifications that take an argument - if I
understand the man page correctly:

http://node1.yo-linux.com/cgi-bin/ma...nd=getopt(3%29

Note that it works just fine with "/" specifiers, and that escaping the -
with ` will also inhibit parsing.


"Marty List" <usenet@optimumx.com> wrote in message
news:u%23uC3MPCHHA.996@TK2MSFTNGP02.phx.gbl...
>
> Seems like a bug to me, but try putting the parameters inside quotes:
> ftp.exe '-s:ftpcommands.txt'
> ftp.exe "-s:ftpcommands.txt"
>
> or use a backtick escape character (under the ~tilde):
> ftp.exe `-s:ftpcommands.txt
>
>
>
> "JakeDAHS" <jskiba99@gmail.com> wrote in message
> news:1163620805.275275.156820@b28g2000cwb.googlegroups.com...
>> After 10 minutes of frustration in ps, found the script I was using
>> works just as it should in cmd.exe possibly something with the
>> paramters?
>>
>> an overview of a ftp script http://support.microsoft.com/kb/96269
>>
>> works ok
>> CMD - ftp -s:ftpcommands.txt
>> -------------------------------------------
>> throws up help for the ftp.exe
>> PS - ftp -s:ftpcommands.txt
>> -------------------------------------------
>> -------------------------------------------
>> throws up help for the ftp.exe (expected)
>> CMD - C:\>ftp -s:
>> -------------------------------------------
>> a different type of error (from powershell and not ftp.exe?)
>> PS C:\> ftp -s:
>> Parameter -s: requires an argument.
>> At line:1 char:7
>> + ftp -s: <<<<
>>

>
>



My System SpecsSystem Spec
 

Thread Tools


Similar Threads for: FTP Script
Thread Forum
Logon Script Causing Laptops To Hang - Problems in script? VB Script
problem passing args to script 'There is no script engine for file extenstion' VB Script
Include another script, keep variables in included script? PowerShell
Script file has 'OS Handle' error when run from script PowerShell
Can you drag-n-drop a file on top of a PS script to run the script? PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51