WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: kdmoyers on February 04, 2015, 06:04:38 AM

Title: use ErrorModes around your FileCopy
Post by: kdmoyers on February 04, 2015, 06:04:38 AM
Tony, in a recent thread response you mentioned
Quoteuse ErrorModes around your FileCopy
I've had bad luck with that particular trick.  It seems that some of the network copy errors I tend to get are not trapped by the errormode(@off). For example, if I copy a file to a printer on a remote machine (like \\TD4\ClericalLab ) and that machine TD4 is not turned on, that makes a hard fatal error.
Unfortunately, I don't have a workaround to recommend. 

Could the error trapping on FileCopy be made more inclusive? just a suggestion.

-Kirby
Title: Re: use ErrorModes around your FileCopy
Post by: td on February 04, 2015, 08:57:25 AM
In the context of the previous post about copying files to a shared folder, FileCopy will generate a 1008 error if the share is unavailable and ErrorMode traps 1000 level errors.  In fact, I am not aware of any FileCopy generated errors that are not in the 1000 error  level  except for the error 3473 when you specify @True in the third parameter while running in background mode.  So perhaps you are referring to some kind of system exception?  If that is the case then it would be wise to implement a test of some kind to determine if the resource is available before attempting to send a file to a remote printer. 

If on the other hand  you experience a 3000 level error when coping to a printer (wouldn't be the first time I missed something) then you could use IntControl 73 error handling.

Title: Re: use ErrorModes around your FileCopy
Post by: kdmoyers on February 04, 2015, 11:26:06 AM
got it, Thanks.  I'll do some experimenting.
-K
Title: Re: use ErrorModes around your FileCopy
Post by: kdmoyers on February 04, 2015, 02:11:47 PM
oops, it was me. never mind.