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-08-12 03:09
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » Input question View 710 Replies 1
Original Poster Posted 2010-08-13 09:06 ·  中国 江苏 苏州 电信
新手上路
Credits 6
Posts 6
Joined 2010-08-12 15:00
15-year member
UID 172251
Gender Male
Status Offline
set /p name= 【Please enter username】:
1. I want it to exit directly after five minutes
2. If the input contains spaces, pressing Enter will exit. What I originally wanted was for it to return directly to the input screen
How should I handle this?
Floor 2 Posted 2010-08-14 17:37 ·  中国 上海 静安区 电信
初级用户
Credits 28
Posts 28
Joined 2010-07-28 11:06
16-year member
UID 171355
Gender Male
Status Offline
I don't know the first one. But I know a tiny bit about the second one. It may be rather troublesome, haha. After all I'm just a newbie, so please forgive me if it's not good.
@echo off
goto 0
setlocal enabledelayedexpansion

:0
set /p name=【Please enter username】:
if not [!name!]==[] ......
if [!name!]==[] echo Your input is incorrect, please enter it again.&goto 0
Forum Jump: