WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Error Codes

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Error 3357: Endif Match Not Found

Keywords:  3357 error level list errors Endif Match Not Found  if

  1. The obvious problem is that an ENDIF will be missing. WinBatch may not be smart enough to tell you it needs a next instead of an ENDIF.

  2. Also, reserved words may cause an error such as this. WinBatch has words which cannot be used as variables or labels. If someone uses one, WinBatch may complain but not be able to specify what the problem really is.

  3. I've also seen this error when you have many "goto"s inside of a while/endwhile loop, or inside of a if/endif loop. Use flags instead of gotos (see article #W12997 on what I'm talking about here).

  4. Another situation where you would get this message is if you illegally used the errormode function inside of an if/endif loop, such as is the case in the following example script:
    DirChange(TargetDir)
    ErrorMode(@OFF)
    FileAttrSet("*.*","rAsh")    ;Clear RSH/ Set A	target attributes for copy
    			   ;in case there are existing files with set attribs
    ErrorMode(@CANCEL)
    :DDM20	;This bit deletes files in the Target Directory 
    for j=1 to TargetNo
      Item=ItemExtract(j,TargetList,@tab) ; Get each entry in the target list
    errormode(@off)
       if FileDelete("%TargetDir%\%Item%")!=@True ; Failed!
         Display(1,"Updaten START_MENU", "Problemen met verwijderen van : %TargetDir%\%Item%")
       Endif ; 012
    errormode(@cancel)
    :DDM22
    next j		 
    
Here's the revised code below. Notice that we turn errormode off before and after the filedelete, and then do the test inside of the if/endif loop.
DirChange(TargetDir)
ErrorMode(@OFF)
FileAttrSet("*.*","rAsh")    ;Clear RSH/ Set A	target attributes for copy
			   ;in case there are existing files with set attribs
ErrorMode(@CANCEL)
:DDM20	;This bit deletes files in the Target Directory 
for j=1 to TargetNo
  Item=ItemExtract(j,TargetList,@tab) ; Get each entry in the target list
errormode(@off)
   xxx=FileDelete("%TargetDir%\%Item%")!=@True ; Failed!
errormode(@cancel)
     if xxx!=@TRUE
     Display(1,"Updaten START_MENU", "Problemen met verwijderen van : %TargetDir%\%Item%")
   Endif ; 012
:DDM22
next j 

Article ID:   W12957
Filename:   3357  Endif Match Not Found.txt
File Created: 2014:07:18:09:51:38
Last Updated: 2014:07:18:09:51:38