Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!uwm.edu!ux1.cso.uiuc.edu!uxh.cso.uiuc.edu!rlarson2 From: rlarson2@uxh.cso.uiuc.edu (Robert S larson) Newsgroups: comp.os.msdos.misc Subject: Re: Bath file progamming Keywords: bat, batch Message-ID: <1991Mar9.205349.28327@ux1.cso.uiuc.edu> Date: 9 Mar 91 20:53:49 GMT References: Sender: usenet@ux1.cso.uiuc.edu (News) Organization: University of Illinois at Urbana Lines: 35 neil@ms.uky.edu (Neil Greene) writes: >I have a batch file I would like to write for our local network. >The outline is something like this: > > setup necessary variables specific to machine_name > : login /*label: attempt to login to server */ > get user_name and password > if %error_level% is ok, go to resources > if %error_level% ~ok, issue error and attempt to login again > : resources > grab network resources > check user mail >My problem is this, everything is fine logicly, and would be great, BUT batch >files cannot trace BACKWARDS. How can I implement this using a batch file and >allow this type of error checking? The solution is easy -- if the user name and password are not o.k., issue an error message, then re-invoke the same batchfile. The original batch file will be terminated in the process. Assuming your batch were named login.bat, it would go something like this: :login get user_name and password if %error_level% is ok, go to resources echo Error Message pause logon :resources grab network services check user mail It's important to reinvoke the batch like this rather than with the CALL command, which will return to the original batch file upon completion of the second.