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-13 02:23
中国DOS联盟论坛 » DOS学习入门 & 精彩文章 (教学室) » Question: How are the return codes for IF ERRORLEVEL defined? View 595 Replies 0
Original Poster Posted 2003-12-01 00:00 ·  中国 上海 崇明区 电信
初级用户
Credits 116
Posts 2
Joined 2003-07-10 00:00
23-year member
UID 6726
Gender Male
Status Offline
Question: if I execute a command, how is the error return code after IF ERRORLEVEL defined??
For example: after GHOST fails to restore my system, I want it to display an error message, and after a successful restore, display a success message. How should I set it up??
:RESTORE
CHOICE /C:YN /T:N,10 CAUTION:All data on disk C will be lost,are you sure
IF ERRORLEVEL 2 GOTO QUIT
LH SMARTDRV.EXE 4096
@echo Please waiting....
GHOST -clone,mode=pload,src=F:\WIN98BAK.GHO:1,dst=1:1 -sure
IF ERRORLEVEL ? ECHO Restore system failure! GOTO QUIT
@echo Your system is restored successfully.
@echo Please remove the floppy diskette and reboot your computer!
GOTO QUIT
Forum Jump: