如何userinput而无需键入一个批处理文件 [英] how to userinput without typing to a batch file

查看:110
本文介绍了如何userinput而无需键入一个批处理文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图运行需要用户输入Y / N做进一步行动的批处理文件。我想打电话给自动化此批处理文件,作为自动化的说法是或没有必要在无需用户干预传递,任何想法如何实现呢?

I am trying to run a batch file which requires user input "y/n" to do further action. I want to call this batch file for automation, as during automation argument yes or no need to be passed without user intervention, any idea how to achieve it ?

cmd /c setup.bat

现在,如果的setup.bat 运行yes或no需要进行选择,以获得所需的结果
因为现在这个的setup.bat 的自动化过程中调用。反正是有传是参数为输入,以的setup.bat

Now if setup.bat is run " yes or no " need to be selected to get the desired result as now this setup.bat is called during automation. Is there anyway to pass "yes" parameter as an input to setup.bat?

推荐答案

以下命令行使用,以通过模拟键preSS自动回答是(将包括 ENTER 键)。

Use below command line to automate "yes" answer by simulating y key press (will include the ENTER key).

cmd /c echo y^> "%temp%\answer.tmp" ^& (setup.bat ^< "%temp%\answer.tmp") ^& del "%temp%\answer.tmp"

要通过模拟自动否的答案 N 键,然后ENTER`键。

To automate "no" answer by simulating n key then ENTER` key.

cmd /c echo n^> "%temp%\answer.tmp" ^& (setup.bat ^< "%temp%\answer.tmp") ^& del "%temp%\answer.tmp"

要通过模拟是键presses那么 ENTER 键自动回答是:

To automate "yes" answer by simulating "yes" key presses then ENTER key:

cmd /c echo yes^> "%temp%\answer.tmp" ^& (setup.bat ^< "%temp%\answer.tmp") ^& del "%temp%\answer.tmp"

要通过模拟无键presses那么 ENTER 键自动否的答案:

To automate "no" answer by simulating "no" key presses then ENTER key:

cmd /c echo no^> "%temp%\answer.tmp" ^& (setup.bat ^< "%temp%\answer.tmp") ^& del "%temp%\answer.tmp"

这篇关于如何userinput而无需键入一个批处理文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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