China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-06-30 02:22
中国DOS联盟论坛 » DOS疑难解答 & 问题讨论 (解答室) » How do batch commands handle Enter? View 823 Replies 3
Original Poster Posted 2006-03-14 18:46 ·  中国 广西 南宁 电信
新手上路
Credits 6
Posts 1
Joined 2006-03-14 18:42
20-year member
UID 52033
Status Offline
For example, after I run a command, the program asks for a response, and I want to just press Enter directly. How do I handle that in a batch file?
Floor 2 Posted 2006-03-14 19:53 ·  中国 山东 济南 移动
钻石会员
★★★★★
Credits 10,046
Posts 3,039
Joined 2002-11-11 00:00
23-year member
UID 223
Gender Male
Status Offline
echo and the pipe operator should be able to solve it
简单就是美
Floor 3 Posted 2006-03-14 19:55 ·  中国 广东 广州 天河区 电信
金牌会员
★★★★
D◎$ Fαп
Credits 4,562
Posts 1,883
Joined 2004-01-19 00:00
22-year member
UID 15812
Gender Male
From 广东广州
Status Offline
Assuming the command you mean is program, in a batch file you can use the ECHO. pipe operation, or use the third-party tool KPUSH to send the Enter key's keyboard code (13) into the keyboard buffer, for example:

...
echo.|program
...

or

...
kpush 13
program
...

[ Last edited by JonePeng on 2006-3-14 at 19:58 ]
----====≡≡≡≡ 我的至爱,永远是MSDOS!≡≡≡≡====----
Floor 4 Posted 2006-03-17 09:25 ·  中国 上海 电信
初级用户
Credits 64
Posts 18
Joined 2006-03-17 09:15
20-year member
UID 52244
Gender Male
Status Offline
echo.|time is for handling the Enter action after the TIME command~~
Forum Jump: