neil@ms.uky.edu (Neil Greene) (03/10/91)
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 resources should not be allocated, UNLESS we have a valid user and password. If user and password are not ok, I wish to issure login prompt again. -- Neil Greene --- University of Kentucky Mathmatics and Sciences University of Kentucky Computing Center neil@s.ms.uky.edu & neil@graphlab.cc.uky.edu (NeXT Attachments)
rlarson2@uxh.cso.uiuc.edu (Robert S larson) (03/10/91)
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.
neil@ms.uky.edu (Neil Greene) (03/11/91)
rlarson2@uxh.cso.uiuc.edu (Robert S larson) writes: > [solution to batch file programming] I figured this would be the only solution, I was looking for a solution that would not need to re-call the origional batch file. BUT, thanks for the solution. I think the only way to accomplish this would be through recalling it. -- Neil Greene --- University of Kentucky Mathmatics and Sciences University of Kentucky Computing Center neil@s.ms.uky.edu & neil@graphlab.cc.uky.edu (NeXT Attachments)
valley@uchicago (Doug Dougherty) (03/12/91)
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? What do you mean "batch files cannot trace BACKWARDS" ? Are you saying that you don't think you can goto a label preceding the current position in a DOS batch file? If so, you should try it sometime...