In a cmd script (is this the same as a batch script?) I want to execute a command only if file1
is newer than file2
. Both files reside in the same directory.
I found many things on SO but none do exactly what I need, or do it in a very roundabout way or don't consider localization.
Just something like this:
if "%file1%" is_newer_than "%file2%" (
execute command
)
- I do not want to find which file is newer.
- I do not want to find the date of the newest file.
- It must be locale-independent so no string manipulations of a formatted date allowed! (the script will be used around the globe)
- The command itself is not date-aware, unlike the likes of
xcopy
.
This answer looks the most promising, but I have no idea how to use that function twice in an if
statement.