プロが教える店舗&オフィスのセキュリティ対策術

PowerShellから非対話でftpできますか?


ftpのパラメータファイルを用意し実行しましたが機能しません。

同じ事をコマンドプロンプトから実行すると、機能しました。

PowerShellから、すべて手打ちで入力すると、機能しました。



■ C:\test\aaa.param ■
open hostftpsv1
test
test
binary
disconnect
bye
■ C:\test\aaa.param ■



■ PowerShellで実行 ■
PS C:\test> ftp -s:C:\test\aaa.param

Transfers files to and from a computer running an FTP server service
(sometimes called a daemon). Ftp can be used interactively.

FTP [-v] [-d] [-i] [-n] [-g] [-s:filename] [-a] [-A] [-x:sendbuffer] [-r:recvbuffer] [-b:asyncbuffers] [-w:windowsize] [
host]

-v Suppresses display of remote server responses.
-n Suppresses auto-login upon initial connection.
-i Turns off interactive prompting during multiple file
transfers.
-d Enables debugging.
-g Disables filename globbing (see GLOB command).
-s:filename Specifies a text file containing FTP commands; the
commands will automatically run after FTP starts.
-a Use any local interface when binding data connection.
-A login as anonymous.
-x:send sockbuf Overrides the default SO_SNDBUF size of 8192.
-r:recv sockbuf Overrides the default SO_RCVBUF size of 8192.
-b:async count Overrides the default async count of 3
-w:buffer size Overrides the default transfer buffer size of 65535.
host Specifies the host name or IP address of the remote
host to connect to.

Notes:
- mget and mput commands take y/n/q for yes/no/quit.
- Use Control-C to abort commands.
■ PowerShellで実行 ■



■ cmdで実行 ■
C:\test>ftp -s:C:\test\aaa.param
ftp> open hostftpsv1
Connected to hostftpsv1.
220-FileZilla Server version 0.9.34 beta
220-written by Tim Kosse (Tim.Kosse@gmx.de)
220 Please visit http://sourceforge.net/projects/filezilla/
User (hostftpsv1:(none)):
331 Password required for test

230 Logged on
ftp> binary
200 Type set to I
ftp> disconnect
221 Goodbye
ftp> bye
■ cmdで実行 ■

A 回答 (1件)

PowerShell,PowerShell ISE共に再現しない。



#動作確認を込めてmputを含めたところ)正常にファイルが転送されることを確認した。
#検証環境 FileZilla Server 0.94-3 + Windows XP SP3
    • good
    • 0
この回答へのお礼

動作検証して頂いたのですね。
お手数を取らせました。
有難う御座います。

コンピュータをイジっていて一番困るのが不再現です。

私がやった範囲では、エビデンスの通り、全くうまく行きませんでした。

PowerShellは入力側のリダイレクトをサポートしていないので、
ftp << EOF
コマンド
EOF
のような書き方も受け付けてくれなかったし、途方に暮れます。

お礼日時:2010/05/14 00:52

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!