# GOTO's and Batch

Hewlett-packard / Sd2100
April 5, 2009 at 20:49:29
Specs: Windows XP, 1024
 Is it considared bad programming if one used GOTO commands alot? but does the job

See More: GOTOs and Batch

#1
April 6, 2009 at 03:25:15
 Like anything else, it depends on how you use them.

Report •

#2
April 6, 2009 at 09:36:48
 Such as What? give an example of bad vs good if you can.

Report •

#3
April 6, 2009 at 10:00:53
 I use GOTO commands all the time. I have 20-30 commands in one batch file that look in a folder to see if there are any files, if there are it goes to on : if not it goes to another for example dir /b /a-d c:\test\*.* >nul 2>nul && GOTO file goto nofile, i don't see any bad practice in this. I think when you get into bad programming is when you do commands like that, that could potentially go either way. For example if you knew there was a possibility of something unexpecteding going into my c:\test folder, my script from the example would pick it up even if I didn't want it to.

Report •

Related Solutions