Computing.Net > Forums > Programming > ERRORLEVEL on DEL command

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

ERRORLEVEL on DEL command

Reply to Message Icon

Name: rojanu
Date: July 21, 2008 at 01:24:18 Pacific
OS: Windows XP SP2
CPU/Ram: intel p4 1024 Mb ram
Comment:

Hi!

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

Any ideas?



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: July 21, 2008 at 01:39:12 Pacific
Reply:

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


0

Response Number 2
Name: Pagey
Date: July 21, 2008 at 05:03:43 Pacific
Reply:

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!


0

Response Number 3
Name: rojanu
Date: July 21, 2008 at 05:15:11 Pacific
Reply:

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


0

Response Number 4
Name: Pagey
Date: July 21, 2008 at 06:25:14 Pacific
Reply:

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....


0

Response Number 5
Name: rojanu
Date: July 21, 2008 at 07:41:40 Pacific
Reply:

I already use a similar code but ERRORLEVEL is much more neater

Thanks anyway, I appreciate your time


0

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: ERRORLEVEL on DEL command

Question on this command www.computing.net/answers/programming/question-on-this-command/19124.html

Batch FOR Loop %ERRORLEVEL% www.computing.net/answers/programming/batch-for-loop-errorlevel/13528.html

Help on Borland command line tools www.computing.net/answers/programming/help-on-borland-command-line-tools/6863.html