中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-05 07:55
48,038 topics / 350,123 posts / today 0 new / 48,251 members
DOS批处理 & 脚本技术(批处理室) » Question about spaces in batch files, solved!
Printable Version  872 / 2
Floor1 lzwqdbr Posted 2007-07-01 14:57
初级用户 Posts 10 Credits 23
When using IF in a BAT or CMD command to test keyboard input, if the input is a space, it gives an error!
For example:
:int
@ECHO off
set pass=0
set /P pass=请输入:
if %pass%==z goto end
goto INT

:end
pause
exit
If you enter a space when running it, it will say “goto was unexpected at this time”

[ Last edited by lzwqdbr on 2007-7-1 at 03:55 PM ]
Floor2 wudixin96 Posted 2007-07-01 15:05
银牌会员 Posts 931 Credits 1,928
Floor3 liumingqing Posted 2007-07-04 09:42
初级用户 Posts 73 Credits 136
Learning from post #2!
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023