January 25th, 2005, 06:12 PM
Ignore errors in batch files?
I am trying to write a batch file that will start at Drive A, search for files with the extension of FDB and make a list of those filenames and paths, and save to a text file. If there is no disk or flash drive, I prefer it continue, not stop with a fatal error.
DIR *.FDB/S/B > C:\FDBDATA\ADATA.DAT
DIR *.FDB/S/B > C:\FDBDATA\BDATA.DAT
DIR *.FDB/S/B > C:\FDBDATA\CDATA.DAT
...and so on until Drive Z.
At the end of creating the files, I can combine them to make one data file. This is the file I am looking for.
My efforts fail when there is no floppy, flash, or pen diskette/drive in those letters. When there is no floppy/pen, I would prefer it just try the next letter and keep on going.
After creating those files, I can combine them and use them for a genealogy program. It would be nice if this would run minimized so a new user won't get stressed at seeing all the commands.
Any ideas please?
Thank you very much.
September 2nd, 2010, 09:04 AM
Try something like (for drive A)
If NOT errorlevel 1 Dir A: *.FDB/S/B > C:\FDBDATA\ADATA.DAT
This should only execute the Dir A: *.FDB/S/B > C:\FDBDATA\ADATA.DAT command if the drive exists. May need some tweaking.
Hope this helps
Originally Posted by Abatch User
September 6th, 2010, 07:27 AM
re: Ignore errors in batch files?
I think you can ignore errors in batch files by using proper code.
Thanks for providing information
Comments on this post