Reputation: 67
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
If you can suggest any better ways or any improvements please say.
Upvotes: 2
Views: 759
Reputation: 57252
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
)
Upvotes: 1