Using batch file I scan my PC for viruses using McAfee. At the end of the scan it writes locally file called 'OnDemandScanLog.txt'. The last step before I shut down the system I have to copy this file from local directory to shared folder. The problem is that sometimes it does not copy it. In case when it failed I always could copy it manually using 'copy' command but I need it to be done at the end of the scan. I assume that I could copy it condititionally ... and check for ERRORLEVEL until it get copied for sure. Then it should shut down PC. Could someone please help me to insert conditional statement in order to make sure it was copied. I will attach my batch file:
@echo off
REM Perform a Full scan and log result
if exist "%ProgramFiles(x86)%" (
set "PATH_=%ProgramFiles(x86)%\McAfee\VirusScan Enterprise"
set SHUTDOWN=shutdown /s /f
) else (
set "PATH_=%ProgramFiles%\McAfee\VirusScan Enterprise"
set SHUTDOWN=shutdown -s -f
)
set LOGDIR=C:\McAfee
set VADIR=\\servername\McAfee Logs\Log1\
"%PATH_%\scan32.exe" /Task {ED73BEB7-1E8F-45AC-ABBC-A749AF6E2710} %* /ANALYZE /MANY /ALL /CLEAN /DAM /NC /NOEXPIRE /PLAD /PROGRAM /SUB /STREAMS /UNZIP /THREADS=4 /TIMEOUT=15 /APPEND /AUTOEXIT
copy %LOGDIR%\OnDemandScanLog.txt /Y "%VADIR%"
start %SHUTDOWN%