windows - Checking if two files in batch are the same size -


if have path 2 files in different windows directories, how can compare same size?

%appdata%/profiles.ini %username%/desktop/profiles.ini 

i want compare same file, first thing comes mind check

  1. the files have same name
  2. the files same size

if can suggest better ways or improvements please say.

as know file names , why need check if names same?

not tested.

this test if files have same size

@echo off set "file1=%appdata%/profiles.ini" set "file2=%appdata%/profiles.ini"  /f "tokens=1,2 delims=?" %%a in ("%file1%?%file2%") (  if %%~za equ %%~zb (     echo equal  ) else (    echo not equal  )  ) 

edit.

may fc command need (compares content of 2 files).

@echo off set "file1=%appdata%/profiles.ini" set "file2=%appdata%/profiles.ini" fc "%file1%" "%file2%" && (     echo files same    color )||(    echo files different ) 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -