批(Windows)中执行脚本等待请求,并输入答案 [英] Batch (Windows) execute script wait for request and input the answer

查看:685
本文介绍了批(Windows)中执行脚本等待请求,并输入答案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题:
我想创建一个执行其他脚本一个批处理文件。那么唯一的问题是,你不能参数给予必要的投入。这些脚本要求沿途的一些数据。有什么办法来等待基于此字符串特定类型的字符串和答案?

the problem: I want to create a batchfile that executes other scripts. Then only problem is, you can not give the necessary input by parameters. The scripts ask for some data along the way. Is there any way to wait for a specific kind of string and answer based on this string?

有点像VBS在SecureCRT的:crt.screen.WaitForString(问题)

kinda like VBS in secureCRT: crt.screen.WaitForString("question")

ex output: 'do you want to proceed?'

waitForString("proceed?")
echo "yes"

格尔茨,
Bulki

Greetz, Bulki

编辑:这是不一样的,要求从经由控制台的用户输入。批处理必须由TE推出脚本生成的输出会自动给出一个答案。

this is not the same as asking input from the user via the console. The batch has to give an answer automatically to the output generated by te launched script.

推荐答案

您可以通过管道或重定向到一个巴赫脚本中的字符或字符串,但它是不可能的脚本等待问题(输入),并给出一个回答依赖于此。这属于在Windows命令行的丢失多任务作案。

You can pipe or redirect a character or string to a bach script, but it is not possible for the script to wait for a question (input) and give an answer dependent on this. This belongs on the missing multitasking modus of the windows command line.

这篇关于批(Windows)中执行脚本等待请求,并输入答案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆