ねえ、2 つのファイルのタイムスタンプを比較し、ソース ファイルが新しいかどうかに応じて errorvlvl 0 または 2 を返すはずのこの小さなバッチ ファイルがあります (パラメーターとして 2 つのファイル名が渡されます) が、gtr がタイムスタンプに適した作業..私は時々作業し、他の時間では作業しません...タイムスタンプを整数として解析して比較するにはどうすればよいですか。ところで、変数 source と dest はこのように見えます (私はそれらをエコーして確認しました)
05/06/2012 18:46
REM I use the t prefix here to expand the file location parameters passed in, i into date/time values
set source=%~t1
echo %dest%
set dest=%~t2
echo %source%
if "%source%" gtr "%dest%" goto overwrite
exit /b 0
:overwrite
REM if the source file is newer compare.bat will return an errorlevel of 2, this will then be used in an if statement in the file that called compare.bat to go ahead and overwrite the older file
exit /b 2
アドバイスをよろしくお願いします!! :)