中国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-13 16:29
47,811 topics / 349,897 posts / today 0 new / 48,256 members
DOS学习入门 & 精彩文章 (教学室) » [Help] About dready?
Printable Version  1,128 / 7
Floor1 hzy Posted 2003-07-28 00:00
高级用户 Posts 135 Credits 578
When the drive does not exist, why can't it jump to :error like this?

set get=
get s "inupt drive letter please : "
dready %get% /W
IF NOT ERRORLEVEL 0 goto error
echo drive OK !
goto .............................
:error
echo drive not ready or read-only
-----------------------------------------------------------------------------
It only works if written like this instead. Why?

set get=
get s "inupt drive letter please : "
dready %get% /W
IF ERRORLEVEL 1 goto error
IF ERRORLEVEL 2 goto error
IF ERRORLEVEL 255 goto error

echo drive OK !
goto .............................
:error
echo drive not ready or read-only

Floor2 Roy Posted 2003-07-28 00:00
管理员 Posts 1,633 Credits 4,869
Because Errorlevel is not exact. For example, if Errorlevel is 5, that means errorlevel is equal to 0 through 5.
Floor3 hzy Posted 2003-07-28 00:00
高级用户 Posts 135 Credits 578
Then is it okay if I write it like this?

set get=
get s "inupt drive letter please : "
dready %get% /W
IF ERRORLEVEL 1 IF ERRORLEVEL 2 IF ERRORLEVEL 255 goto error
echo drive OK !
goto .............................
:error
echo drive not ready or read-only




Floor4 hunome Posted 2003-07-28 00:00
银牌会员 Posts 721 Credits 2,265
It should be okay, I guess. Just try it yourself and you'll know.
Floor5 hunome Posted 2003-07-28 00:00
银牌会员 Posts 721 Credits 2,265
Feels like it still won't work.
Floor6 Wengier Posted 2003-07-31 00:00
系统支持 Posts 10,521 Credits 27,736
NO NO NO!

IF ERRORLEVEL 1 means when the value of ERRORLEVEL is >=1 (greater than or equal to 1), not <=1.
Floor7 hzy Posted 2003-08-01 00:00
高级用户 Posts 135 Credits 578
Many thanks
Floor8 蓝雨v21 Posted 2004-04-21 00:00
初级用户 Posts 1 Credits 105
This is exactly what I was looking for!
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023