zipi
zipi

Reputation: 733

batch file with robcopy

I use with robcopy in my batch file. I want that if these batch file will run on OS without robcopy installed the error about it WILL appear in the loG file.the error about it is:

'robocopy' is not recognized as an internal or external command, operable program or batch file.

my code is:

robocopy Obl\BR "%WEBDIR%\BR"  /E /LOG+:%TMPLog% >nul

but this error appear only on the console not appear in TMPLog. maybe errors of this kind should not appear in logs? if yes what I can to do? maybe try and catch if it exist in batch file?!

Upvotes: 1

Views: 661

Answers (1)

Andriy M
Andriy M

Reputation: 77667

I'm not at my Windows 7 PC at the moment so can't really verify this thing, but would logging the output of robocopy using the >> redirection be the same as logging with the /LOG+ switch? If so, you could redirect stderr (where the not recognized message is sent) to stdout, and stdout to your %TMPLog% file, like this:

robocopy Obl\BR "%WEBDIR%\BR"  /E >>%TMPLog% 2>&1

Upvotes: 1

Related Questions