Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows batch script: Perform a command if two files are the same!

I would have thought this was going to be a very simple task but I have been struggling with it for a couple of days now, and slightly frustrated! I am not very familiar with Windows batch scripts so please if you know the answer, keep it as simple as possible :)

Basically, I have a Windows Shutdown script (.bat file) in which I would like to know if two text files are the same (i.e. their content is exactly the same), and if so, perform a goto command (e.g. goto line10)

I can't figure out how to do this! Your help is much appreciated!

like image 880
Merott Avatar asked Feb 26 '11 00:02

Merott


1 Answers

Without the goto:

fc /b file1 file2 > nul
if errorlevel 1 (
    echo different
) else (
    echo same
)
like image 200
SystemParadox Avatar answered Oct 19 '22 08:10

SystemParadox