Hi schmerold-ga,
In light of your needs, I decided that a WSH script would not be
the right solution. A WSH script would be the perfect solution if you
did not need to access its results from a Windows Batch file. Since
this was a requirement, I decided to implement a separate command-line
utility that you can call from a batch file. you can download this
utility from the following link:
http://rapidshare.de/files/33977380/CompareFileDate.exe.html
To run the utility, use it at your command prompt or in your batch file, like this:
CompareFileDate 20-11-2006 c:\autoexec.bat
The above command will compare the file creation date of
'c:\autoexec.bat' with the input date (20th Nov 2006) and store the
comparison result in the ERRORLEVEL environment variable. The result
can be -1,0 or 1 depending on whether the file creation date is less
than, equal to, or greater than the input date. In case of an error,
ERRORLEVEL is set to a value less than -1.
The utility also prints the file creation date of the specified file
onto the screen.
Given below is an example Windows batch file that makes use of this utility:
----------------------------------------------------------------
@echo off
CompareFileDate.exe 19-03-2005 c:\autoexec.bat
if ERRORLEVEL=0 (echo "equal" )else (echo "not equal")
----------------------------------------------------------------
Note that you must specify the full path to 'CompareFileDate.exe' if
the file is not in the same folder as the batch file.
Also note that the utility expects the input date to be in the format dd-mm-yyyy.
Hope this helps.
If you need any clarifications, just ask! i'll be glad to help.
Regards,
Theta-ga
:) |