Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > PowerShell

FTP Script

Closed Thread
 
Thread Tools Display Modes
Old 11-15-2006   #1 (permalink)
JakeDAHS
Guest
 
Posts: n/a

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: <<<<

 
Old 11-15-2006   #2 (permalink)
Marty List
Guest
 
Posts: n/a

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: <<<<
>



 
Old 11-15-2006   #3 (permalink)
JakeDAHS
Guest
 
Posts: n/a

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: <<<<
> >


 
Old 11-15-2006   #4 (permalink)
Adam Milazzo
Guest
 
Posts: n/a

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". :-)
 
Old 11-17-2006   #5 (permalink)
Alex K. Angelopoulos [MVP]
Guest
 
Posts: n/a

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: <<<<
>>

>
>



 
 
Closed Thread

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Include another script, keep variables in included script? pschmidt PowerShell 32 3 Days Ago 01:48 PM
Windows Script Host has no script engine for ".js" files Stephan G. Vista General 9 04-24-2008 03:04 PM
need of a script . don5 PowerShell 7 02-05-2008 03:17 PM
Script file has 'OS Handle' error when run from script Jay PowerShell 1 09-18-2007 07:06 PM
Can you drag-n-drop a file on top of a PS script to run the script? Jen Taylor PowerShell 6 04-06-2007 09:02 AM








Vistax64.com 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 2005-2008

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