将命令发送到现有cmd shell

时间:2017-06-22 16:04:18

标签: python windows cmd windows-console

我试图创建一个脚本来登录类似于ftp的东西,但它不使用ftp命令。我正在考虑尝试批处理文件或Python解决方案。

通过cmd shell手动完成,如下所示:

C:\Users..etc>
passiveftp 123.45.67.890 #connects to ftp in passive mode
#then asks for username and you don't see 'C:\Users..etc.' anymore
Connceted to 123.45.67.890
220 (vsFTPd 3.0.2)

User name:
#here you'd enter user name, then password, then start dl/ul'ing

对于标准的ftp连接,我发现你可以对每个输入使用一个单独的文本文件,然后运行以下命令:

ftp -s:filename.txt

但看起来这个ftp程序不接受。我尝试使用以下文本文件:

passiveftp 123.45.67.890
usernamehere
passwordhere
hash

这导致以下输出:

C:\Users\etc.>passiveftp -s:filename.txt
ftp> Invalid command.
ftp> Invalid command.
ftp> Invalid command.
ftp> Hash mark printing On  ftp: (2048 bytes/hash mark).
ftp>

有没有办法自动化这种情况,比如可以用ftp命令做什么?

0 个答案:

没有答案