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-02 02:24
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » Why are all the error codes returned by del 0? View 1,357 Replies 3
Original Poster Posted 2006-09-19 13:41 ·  中国 广西 北海 电信
初级用户
Credits 54
Posts 18
Joined 2005-11-05 01:38
20-year member
UID 44610
Status Offline
Delete a 11.txt
F:\>del 11.txt /p
F:\11.txt, Do you want to delete (Y/N)? y
F:\>echo %ERRORLEVEL%
0

---------------------------------------
Delete a non-existent 12.txt
F:\>del 12.txt
File F:\12.txt not found
F:\>echo %ERRORLEVEL%
0

--------------------------------------
Delete a file without permission
F:\>del c:\ntdetect.com
c:\NTDETECT.COM
Access denied.
F:\>echo %ERRORLEVEL%
0

That's it. What's going on?
Floor 2 Posted 2006-09-20 00:13 ·  中国 甘肃 兰州 电信
金牌会员
★★★★
Credits 4,103
Posts 1,744
Joined 2006-01-20 13:00
20-year member
UID 49241
Gender Male
From 甘肃.临泽
Status Offline
I don't know the return value of del, but deltree only returns 0
Floor 3 Posted 2006-09-20 00:46 ·  中国 广东 佛山 广东睿江科技有限公司
荣誉版主
★★★★
batch fan
Credits 5,226
Posts 1,737
Joined 2006-03-10 00:38
20-year member
UID 51697
From 成都
Status Offline
Not every command has a return value, maybe del doesn't either.
尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。
Floor 4 Posted 2006-09-20 17:37 ·  美国 北达科他州立大学
中级用户
★★
Credits 316
Posts 152
Joined 2006-06-18 13:01
20-year member
UID 57204
Gender Male
Status Offline
DEL is an internal command, and there should be no return value, so it's all zero.
Forum Jump: