
The first tests errorlevel to be exactly equal to 0 (although = can also be geq for greater than or equal to and 0 can be any numeric to suit various situations).

Two common ways : if %errorlevel%=0 and if errorlevel n (where n is a number. Immediately after a command (such as ren), you can test errorlevel to determine whether there was an error. If you have an error response, the variable errorlevel will usually be set to non-zero (zero meaning "no error"). Set /p var=nul to the line will suppress the normal response, and 2>nul the error response. To determine whether there is text data in a file, use set "var=" Move temp2.dat over temp.dat so you have a new temp.dat file containing the new list Read the first line of that file into a variable using set /p oldfilenametemp2.dat, which finds all of the strings in temp.dat which (/v) do NOT match (/x) eXactly (/L) Literally ( /c:"somestring") the string and redirects the result to temp2.dat

Since this is a homework question, I'll just give you hints:Įxecute a dir /b /a-d "%1" command to list the existing filenames, and redirect this list to a temporary file, say temp.dat
