ERRORLEVEL on DEL command

July 21, 2008 at 01:24:18
Specs: Windows XP SP2, intel p4 1024 Mb ram
Hi!

I thought DEL returns an ERRORLEVEL, However on XP I always get "0" no matter what.

Any ideas?


See More: ERRORLEVEL on DEL command

Report •


#1
July 21, 2008 at 01:39:12
W2K returns 1 on failed DEL.

Wait for IVO or Razor2.3 or one of the guys using XP.


=====================================
If at first you don't succeed, you're about average.

M2


Report •

#2
July 21, 2008 at 05:03:43
You're right, it does output '0' regardless of if it finds a file or not.

Could you not do something similar to below.

IF EXIST C:\File.txt ECHO File Exists!


Report •

#3
July 21, 2008 at 05:15:11
Well that can be done but it is not any use to me, because I am deleting a list files and would like know if a file from list is actually missing, which means a previous process hasn't done its job correctly and needs attention

Report •

Related Solutions

#4
July 21, 2008 at 06:25:14
Could you not use

FOR /F %%i IN (FILESTODELETE.TXT) DO (

IF NOT EXIST %%i ECHO %%iDOES NOT EXIST!

)

You could then puit the list of files to delete in the FILESDOTDELETE.TXT file, after the delete, it will say if it has deleted sucessfully.

I can't think of how else you could adapt DEL as it simply only outputs error levels of 0....


Report •

#5
July 21, 2008 at 07:41:40
I already use a similar code but ERRORLEVEL is much more neater

Thanks anyway, I appreciate your time


Report •


Ask Question