发送命令以启动程序的 BAT 脚本
所以我正在尝试做这样的事情:
ftp my.ip.add.ress
(user id)
(password)
cd /the/directory
send C:/code/project1/*
bye
我知道当你第一次像-send
一样启动它时,你可以通过命令行发送Windows ftp
命令,但问题是我可以使用 .bat 脚本与其启动的程序进行交互操作吗?默认情况下,发生的是第一行:
ftp my.ip
Starts ftp,但后续行永远不会运行,直到 ftp 退出。
编辑
表达此问题的另一种方式是“当下次检查 stdin
是否有输入时,是否可以使用 .bat 文件对文本行进行排队以提供给 stdin
?”
So I'm trying to do something like this:
ftp my.ip.add.ress
(user id)
(password)
cd /the/directory
send C:/code/project1/*
bye
I know you can send Windows ftp
commands through the command line when you first start it like -send
, but the question is can I use a .bat script to act interactively with the program it starts? By default what happens is the first line:
ftp my.ip
Starts ftp, but the subsequent lines never run until ftp
exits.
edit
Another way to phrase this question is "Is it possible to use a .bat file to queue lines of text to feed to stdin
when stdin
is next checked for input?"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
据我所知,命令 shell 不是多线程的,因此当另一个交互式 shell 程序在其中执行时,批处理无法继续执行。
您需要将 FTP 命令移动到它们自己的文件中,并将其传递给 FTP 程序,以便它可以将它们作为自己的内部脚本运行。
指定包含FTP命令的文本文件;这些命令将在 FTP 启动后自动运行。
As far as I know, the command shell is not multi-threaded, so there is no way for a batch to continue executing while another interactive shell program is executing within it.
You need to move the FTP commands into their own file, and pass that to the FTP program so it can run them as its own internal script.
Specifies a text file containing FTP commands; the commands will run automatically after FTP starts.