2

If I have the path to two files in different windows directories, how can I compare they are the same size?

%APPDATA%/profiles.ini %USERNAME%/Desktop/profiles.ini 

I want to compare they are the same file, The first thing that comes to mind is to check

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

If you can suggest any better ways or any improvements please say.

1 Answer 1

1

As you already know the file names , why do you need to check if their names are the same?

not tested.

this test if the files have the same size

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

EDIT.

May be the FC command is what you need (compares content of two files).

@echo off set "file1=%APPDATA%/profiles.ini" set "file2=%APPDATA%/profiles.ini" FC "%file1%" "%file2%" && ( echo files are the same color )||( echo files are different ) 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.