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-09 09:27
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [Help] Please take a look at this batch file jump error View 524 Replies 1
Original Poster Posted 2008-08-09 22:00 ·  中国 云南 大理白族自治州 电信
初级用户
Credits 26
Posts 16
Joined 2008-08-03 20:55
18-year member
UID 122739
Gender Male
Status Offline
@echo off
color 0b
title Hehe
:menu
cls
echo ==============================================================================
Set /p in= Please enter:
If "%in%"=="" goto menu
If "%in%"=="1" Goto ki
If "%in%"=="2" Goto do
If "%in%"=="3" Goto st
If "%in%"=="4" Goto cl
If "%in%"=="0" Exit

:ki
Set /p inki= Execute code:
If "%inki%"=="" goto exit
If "%inki%"=="kdl" Goto kdl

:kdl
echo Executed successfully
pause>nul
goto menu

Question: when I enter other characters for "Execute code", why does it always jump to execute :kdl? What I need is for it to exit when something else is entered. Please help.

[ Last edited by yuwujin on 2008-8-9 at 10:02 PM ]
Floor 2 Posted 2008-08-10 00:03 ·  中国 广东 汕头 电信
高级用户
★★★
DOS时空
Credits 713
Posts 348
Joined 2007-02-10 13:59
19-year member
UID 79169
Gender Male
Status Offline

@echo off
color 0b
title Hehe
:menu
cls
echo ==============================================================================
Set /p in= Please enter:
If "%in%"=="" goto menu
If "%in%"=="1" Goto ki
If "%in%"=="2" Goto do
If "%in%"=="3" Goto st
If "%in%"=="4" Goto cl
If "%in%"=="0" Exit

:ex
exit

:ki
Set /p inki=Run code:
If "%inki%"=="" goto exit
If "%inki%"=="kdl" Goto kdl

:kdl
echo Executed successfully
pause>nul
goto menu


[ Last edited by haiou327 on 2008-8-10 at 12:04 AM ]
Forum Jump: