|
hxj
中级用户
  
积分 377
发帖 66
注册 2005-4-4
状态 离线
|
『楼 主』:
[求助]批处理文件中怎样加入能在DOS下自动输入“y"并执行回
使用 LLM 解释/回答一下
批处理文件中怎样加入能在DOS下自动输入“y"并执行回车功能的语句
我要在批处理文件中加入 能在DOS下自动输入“y",并执行回车 功能,应写入怎样的语句? 请斑竹和高手们指点,谢谢了!
How to add a statement in a batch file that can automatically input "y" and perform the enter function under DOS?
I want to add in the batch file the function of automatically inputting "y" and performing the enter under DOS. What statement should be written? Please guide by the moderator and experts, thank you!
|
|
2005-4-13 00:00 |
|
|
JonePeng
金牌会员
      D◎$ Fαп
积分 4562
发帖 1883
注册 2004-1-19 来自 广东广州
状态 离线
|
『第 2 楼』:
使用 LLM 解释/回答一下
如:echo y | del *.*
如:echo y | del *.*
The example: echo y | del *.*
|

----====≡≡≡≡ 我的至爱,永远是MSDOS!≡≡≡≡====----
|
|
2005-4-13 00:00 |
|
|
hxj
中级用户
  
积分 377
发帖 66
注册 2005-4-4
状态 离线
|
『第 3 楼』:
使用 LLM 解释/回答一下
2楼,我试了不行!还有你的 del *.* 却 把我软盘里东东全消灭光了!!!我的问题是这样的,我用dos盘启动后显示一程序的LOGO图并给出"yes"or"no"选择,我想在批处理文件中加入能自动自动输入“y",并执行回车,这样就可自动继续下面程序启动DOS了。不知还有其它什么好方法吗?
Floor 2, I tried it and it didn't work! Also, your del *.* completely wiped out everything on my floppy disk!!! My problem is like this: I boot with a DOS disk and it shows a program's LOGO image and gives "yes" or "no" options. I want to add in a batch file to automatically input "y" and press Enter, so that it can automatically continue to start DOS for the next program. Is there any other good method?
|
|
2005-4-13 00:00 |
|
|
siyuer
初级用户
 
积分 133
发帖 10
注册 2005-1-16
状态 离线
|
『第 4 楼』:
使用 LLM 解释/回答一下
choice 命令choice 或者choice /c:yn或者你也可以自己用C语言自己编写一个这样的命令,用汇编应该也可以,我没试过。C语言中有一个专门的用于DOS/WINDOWS的函数支持这种做法。
The choice command: choice or choice /c:yn or you can also write such a command by yourself in C language. It should also be possible with assembly, I haven't tried it. There is a special function in C language that supports this practice for DOS/WINDOWS.
|
|
2005-4-14 00:00 |
|
|
hxj
中级用户
  
积分 377
发帖 66
注册 2005-4-4
状态 离线
|
『第 5 楼』:
使用 LLM 解释/回答一下
楼上的办法我也想到过,但choice,只会给出yn选择,仍要手动输入y才行,这就达不到我"自动在DOS下输入y并执行回车“的目标了。而且我试过,到程序出现"y"or"no"行选择后就停住了,不再执行choice命令。
I also thought of the method upstairs, but choice only gives a yes/no choice, and I still have to manually enter y, which doesn't achieve my goal of "automatically entering y under DOS and pressing Enter". Moreover, I tried it, and when the program reaches the line where it asks "y" or "no" for selection, it stops and no longer executes the choice command.
|
|
2005-4-14 00:00 |
|
|
chenhui530
高级用户
   
积分 772
发帖 273
注册 2004-10-23
状态 离线
|
『第 6 楼』:
使用 LLM 解释/回答一下
哈哈~~好笑~~楼主好可爱
Haha~Funny~The LZ is so cute
|

http://www.msfans.net/bbs/ |
|
2005-4-14 00:00 |
|
|
siyuer
初级用户
 
积分 133
发帖 10
注册 2005-1-16
状态 离线
|
『第 7 楼』:
使用 LLM 解释/回答一下
呵呵,这样呀,自动输入y并回车执行,就根本无需判断,直接执行就可以了,echo ?Ycommand^_^
Hehe, that's the case. Automatically input y and press enter to execute, so there's no need for judgment at all, just execute directly. echo ?Ycommand^_^
|
|
2005-4-14 00:00 |
|
|
siyuer
初级用户
 
积分 133
发帖 10
注册 2005-1-16
状态 离线
|
『第 8 楼』:
使用 LLM 解释/回答一下
或者象2楼说的那样echo y | choice
Or as the second floor said, echo y | choice
|
|
2005-4-14 00:00 |
|
|
hxj
中级用户
  
积分 377
发帖 66
注册 2005-4-4
状态 离线
|
『第 9 楼』:
使用 LLM 解释/回答一下
各位大虾,还是看看DOS之家站长的结论吧:
除非提前加载TSR,否则无法实现。因为每个程序执行过程中必须有外来的干预才能中断,中断有两种,一种是用键盘等输入输出设备,一种就是监控程序(驻留程序,英语TSR)在一定条件下触发。
----------------------------------------------
DOS之家 站长 葛明阳
http://doshome.com
我死心了,不再在批处理里做文章了,不过还是要谢谢各位大吓们的热心指点!
对了,楼上的方法,命令根本不执行,因为程序到出现LOGO和“y"or"n"时就停住了等你手工输入"y",不再执行你的命令。
Dear fellow experts, let's still take a look at the conclusion of the站长 of DOS Home:
It cannot be achieved unless TSR is pre-loaded. Because during the execution of each program, an external intervention is necessary to interrupt. There are two types of interruptions: one is through input and output devices such as the keyboard, and the other is that the monitor program (resident program, English TSR) triggers under certain conditions.
----------------------------------------------
Ge Mingyang,站长 of DOS Home
http://doshome.com
I've given up, and I won't work on batch processing anymore, but I still want to thank all the experts for their enthusiastic guidance!
By the way, the method mentioned by the person upstairs, the command simply doesn't execute, because the program stops when the LOGO appears and "y" or "n" is displayed, waiting for you to manually input "y", and won't execute your command.
|
|
2005-4-14 00:00 |
|
|
JonePeng
金牌会员
      D◎$ Fαп
积分 4562
发帖 1883
注册 2004-1-19 来自 广东广州
状态 离线
|
『第 10 楼』:
使用 LLM 解释/回答一下
以下是引用hxj在2005-4-13 22:03:58的发言:
2楼,我试了不行!还有你的 del *.* 却 把我软盘里东东全消灭光了!!!
我的问题是这样的,我用dos盘启动后显示一程序的LOGO图并给出"yes"or"no"选择,我想在批处理文件中加入能自动自动输入“y",并执行回车,这样就可自动继续下面程序启动DOS了。不知还有其它什么好方法吗?
呵呵,由于你事先没有说清楚问题,我只是用del来举例子来示范一下而已,并没有要你把整句照抄。
DOS站长葛阳明的结论是有道理,但不一定非得用TSR不可。MSDOS 7.1启动盘上的Kpush小程序就是一个很好的可设置键盘缓冲区的东东,活用它就可以实现楼主的目的。如:批处理里执行选择Y or N 的语句之前先运行kpush y。
The following is the statement from hxj on 2005-4-13 22:03:58:
On the 2nd floor, I tried and it didn't work! Also, your del *.* completely erased all the things on my floppy disk!!!
My problem is like this: After I boot with a DOS disk, a program's LOGO image is displayed and it gives "yes" or "no" options. I want to add in the batch file to automatically input "y" and press enter, so that it can automatically continue to start DOS for the following program. I wonder if there are any other good methods?
Hehe, since you didn't make the problem clear in advance, I just used del as an example to demonstrate, and didn't ask you to copy the whole sentence exactly.
The conclusion of DOS webmaster Ge Yangming is reasonable, but it's not necessary to use TSR. The Kpush small program on the MSDOS 7.1 boot disk is a very good thing that can set the keyboard buffer. Making good use of it can achieve the purpose of the original poster. For example: Before executing the statement of selecting Y or N in the batch processing, run kpush y first.
|

----====≡≡≡≡ 我的至爱,永远是MSDOS!≡≡≡≡====----
|
|
2005-4-14 00:00 |
|
|
tatami
初级用户
 
积分 120
发帖 5
注册 2005-4-12
状态 离线
|
『第 11 楼』:
使用 LLM 解释/回答一下
可以用输入重定向,先编辑一个文本文件内容是:Yenter然后在运行你的批处理文件后面加上“<文本文件名”就可以了,比如:format a: < zzz.txt
You can use input redirection. First, edit a text file with the content: Yenter. Then add "< text file name" after running your batch file. For example: format a: < zzz.txt
|
|
2005-4-15 00:00 |
|
|
siyuer
初级用户
 
积分 133
发帖 10
注册 2005-1-16
状态 离线
|
『第 12 楼』:
使用 LLM 解释/回答一下
以下是引用hxj在2005-4-14 20:23:44的发言:
各位大虾,还是看看DOS之家站长的结论吧:
除非提前加载TSR,否则无法实现。因为每个程序执行过程中必须有外来的干预才能中断,中断有两种,一种是用键盘等输入输出设备,一种就是监控程序(驻留程序,英语TSR)在一定条件下触发。
----------------------------------------------
DOS之家 站长 葛明阳
http://doshome.com
我死心了,不再在批处理里做文章了,不过还是要谢谢各位大吓们的热心指点!
对了,楼上的方法,命令根本不执行,因为程序到出现LOGO和“y"or"n"时就停住了等你手工输入"y",不再执行你的命令。
不知道我引用的帖子的作者有没有在自己的机器上测试过,如果没有,可不要随便说话!
The following is the speech of hxj on April 14, 2005, 20:23:44:
Dear experts, let's still take a look at the conclusion of the webmaster of DOS Home:
Unless TSR is loaded in advance, it cannot be achieved. Because during the execution of each program, there must be external intervention to interrupt. There are two types of interrupts. One is using input and output devices such as the keyboard. The other is that the monitoring program (resident program, English TSR) triggers under certain conditions.
----------------------------------------------
Ge Mingyang, Webmaster of DOS Home
http://doshome.com
I'm disheartened and won't work on batch processing anymore. But I still want to thank all the enthusiastic guides of you!
By the way, the method of the above-mentioned building, the command does not execute at all. Because the program stops and waits for you to manually input "y" when it appears LOGO and "y" or "n". No longer execute your command.
I don't know if the author of the quoted post has tested it on his own machine. If not, don't talk casually!
|
|
2005-4-19 00:00 |
|