Quote from: vancewatkins on March 02, 2017, 07:58:14 AM
FROM = "Drive:\Folder\File_that_does_not_exist.txt"
Attempting to obtain the date of a non existent file causes an 1152 error. This causes the return value of the FileYmdHms function to be undefined because the parser stops processing the line containing the error. This also means that the "if" statement is not fully processed which is the cause of the subsequent "endif" structure error.
Quote
TO = "Drive:\Folder\File_that_does_exist.txt"
IF FileYmdHms(FROM) > FileYmdHms(TO)
"To" is a reserved word and treating it as a variable causes an 3362 fatal error. The "3" at the beginning of an error number indicates that it is a sever (fatal) error.
There are several discussions of error handling in the Consolidate WIL Help file and at the Tech Database website:
http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+WinBatch+Two~Minute~Lecture~on~ErrorMode~No-Nos.txt (http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+WinBatch+Two~Minute~Lecture~on~ErrorMode~No-Nos.txt)
and
http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+Tutorials+Trap~Errors.txt
(http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+Tutorials+Trap~Errors.txt)