发送命令以启动程序的 BAT 脚本

发布于 2024-10-07 22:38:35 字数 451 浏览 0 评论 0原文

所以我正在尝试做这样的事情:

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

情仇皆在手 2024-10-14 22:38:35

据我所知,命令 shell 不是多线程的,因此当另一个交互式 shell 程序在其中执行时,批处理无法继续执行。

您需要将 FTP 命令移动到它们自己的文件中,并将其传递给 FTP 程序,以便它可以将它们作为自己的内部脚本运行。

ftp -s:filename

指定包含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.

ftp -s:filename

Specifies a text file containing FTP commands; the commands will run automatically after FTP starts.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文