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
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.
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
Summary: On closer inspection it doesn't seem to be such a good idea.... All you need to do is find a command that bottoms out without admin privileges that doesn't actually do much if you do, a good one to tr...
Summary: Here is the code: for /f %%Q in (machines.txt) do ( ping -n 1 -w 3 %PingThis% IF %ERRORLEVEL% == 0 echo %%Q >> alive.txt ELSE echo %%Q Failed Ping >> dead.txt ) Now, the problem is this. In machines....
Summary: This is my first time on this forum, so I'm guessing it's for anything programming related. I was wondering if someone could help me with Borland's free command line tools. I've been trying to compi...