Help on a batch file
Ok I made this batch file that looks for a file on computers backs it up and replaces it. We can call the file we are looking for file.a and the file that is going to replace it file.b (they share the same name) So right now when the batch script finds file.a it makes a copy of file.a in the same director named its file.a.old then copys file.b over file.a. What I would like to do is add an if statement to this batch file that check the size of the original file.a. If file.a size is = 2.69MB or 2,826,240 bytes then make a backup file.a.old and replace file.a with file.b. if not leave file.a alone and do nothing.
There is my code right now that just searches, backups and replace file.a
for %%i in (c d e f g h i j k l m n o p q r s t u v w x y z) do (
for /f "tokens=* delims= " %%a in ('dir/b/s/a-d %%i:\file.a 2^>nul') do (
mo开发者_Python百科ve /y %%a %%~DPa\file.a.old
move /y file.b %%a
)
)
It would be great if some one could help me add this if statement into this patch file.
Thanks
for /f "tokens=* delims= " %%a in ('dir/b/s/a-d %%i:\file.a 2^>nul') do (
if %%~za gtr xxxxxx .....
)
精彩评论