Hi,
Glad you solved it!
I believe your original understanding is still correct!
Echo and Set does not set or reset the Errorlevel system variable, at least not in Windows 7 and later. (Batch files - Errorlevels)
If duplicacy output is piped to another command, like the Find command, Find will pass on the matching data and set the exit code so you can make choices based on the result of the complete pipeline. (Piping data through commands will return the exit code from the last command)
An example which loses the first exit code
"C:\Program Files\Duplicacy\duplicacy.exe" -log backup -stats | find "ERROR"
REM Errorlevel now contains the result of the Find command (not Duplicacy result)
REM And it will be 0 only if the logfile contains the word ERROR
echo The last command result: %errorlevel%
Like you say, one could first backup (saving the output to a file is fine), save the exit code in a new variable, then you can investigate file with other commands.
Save backup exit code first
"C:\Program Files\Duplicacy\duplicacy.exe" -log backup -stats > %Log%
set Error=%errorlevel%
type %Log% | find "ERROR" > %Tempfile%
REM %Error% should still have duplicacys exit code
REM %errorlevel% should contain the result of the find command
Sometimes these things get complicated! Production code is always longer!