2

ねえ、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 

アドバイスをよろしくお願いします!! :)

4

1 に答える 1

2

わかった。私はそれを得た..私は思う!

set compsource= %dest:~6,4%%dest:~3,2%%dest:~0,2%%dest:~6,4%%dest:~11,2%%dest:~14,2%
于 2012-06-05T18:44:31.017 に答える