Hey, I need a batch file that to this:
Check two folders C:\Program and \\Update.
If the C:\Program\file.exe is equal to \\Update\file.exe, then it skips the update and starts C:\Program\file.exe.
If C:\Program\file.exe is older that \\Update\file.exe, then it copy or move C:\Program\file.exe to C:\Program\Backup\ and renames file.exe to file_date.exe, copy \\Update\file.exe to C:\Program\ and then starts C:\Program\file.exe.
I already have a batch file, but it doesn't check the two files, and I need to go to all the machines to force the update.
@echo off
cls
echo ======= FILE UPDATE =======pushd "%~dp0"
xcopy C:\Program\file.exe /Y "C:\Program\Backup"
rename "C:\Program\file.exe" file_%date%.exe
xcopy "\\Update\file.exe" /Y C:\Program\file.exe /D
popd
@echo off
pause@echo off
start C:\Program\file.exeThank you in advance
Try this:
Echo n| comp C:\Program\file.exe "\\Update\file.exe"
If %errorlevel% EQU 0 GOTO SAME
Echo D| xcopy /y /q "\\Update\file.exe" C:\Program\file.exe
GOTO UPDATE
:SAME
Echo File is the same
:UPDATE
Echo File was updated
Yes (14) | ![]() | |
No (14) | ![]() | |
I don't know (15) | ![]() |