Scheduled upload doesn't work from .bat file, Win 2012 R2
Hi,
I have a .bat file with something like this:
Working cool, if I run it manually, but unfortunately scheduled task doesn't upload it. Archive is done, just WinSCP upload is not working. There is no log records for uploading (only if I run it by hand). Can anybody help me? Thanks
I have a .bat file with something like this:
@echo off title Backup SET logfile=C:\backup\Backup.log echo ------------------------START Backup------------------------ >>%logfile% 2>&1 date /T >>%logfile% 2>&1 time /T >>%logfile% 2>&1 if not exist "C:\Backup" mkdir C:\Backup if not exist "C:\Backup\Archive" mkdir C:\Backup\Archive echo -----copy----- >>%logfile% 2>&1 xcopy C:\\design\* C:\Backup\design\* /y /s del /F /Q c:\AIC_Backup\Archive\* "c:\backup\7-Zip\7z" a -r C:\Backup\Archive\Backup.7z C:\AIC_Backup\* echo errorlevel: %ERRORLEVEL% IF %ERRORLEVEL% == 0 GOTO OK echo. echo !!! ERROR There was a problem during zip procedure. ErrorLevel = %ERRORLEVEL% echo. GOTO end :OK echo ------------------------Archive Done------------------------ >>%logfile% 2>&1 echo ------------------------Start Uploading------------------------ >>%logfile% 2>&1 "c:\Program Files (x86)\WinSCP\winscp.com" /command "open sftp://root:root@server/" "put c:\Backup\Archive\Backup.7z /data1/backup/Backup.7z" "exit" "/log=Backup.log" "/loglevel=1" echo ------------------------Uploading Done------------------------ >>%logfile% 2>&1 :end echo ------------------------Backup Done------------------------ >>%logfile% 2>&1