2 :: usage: ifchange target temporary
\r
4 if "%1" == "" goto :end
\r
10 if not "%dest%" == "" if not "%dest%" == "%%dest:/=\%%" goto :nt
\r
12 if not exist %2 goto :end
\r
14 :: check if fc.exe works.
\r
15 echo foo > conftst1.tmp
\r
16 echo bar > conftst2.tmp
\r
17 fc.exe conftst1.tmp conftst2.tmp > nul
\r
18 if not errorlevel 1 goto :brokenfc
\r
19 del conftst1.tmp > nul
\r
20 del conftst2.tmp > nul
\r
22 :: target does not exist or new file differs from it.
\r
23 if not exist %1 goto :update
\r
25 if errorlevel 1 goto :update
\r
33 del conftest1.tmp > nul
\r
34 del conftest2.tmp > nul
\r
35 echo FC.EXE does not work properly.
\r
36 echo assuming %1 should be changed.
\r
40 :: if exist %1 del %1
\r
47 if not exist %src% goto :end
\r
49 fc.exe %dest% %src% > nul && (
\r
50 echo %dest% unchanged.
\r
55 echo %dest% updated.
\r
56 copy %src% %dest% > nul
\r