::::::::::::::::::::::::::::::::::::::::::::::::::::
::Create a log file containing todays date
::LogPath is the path to the folder where the log file will be saved
::LogFileName is a descriptive name that will be added after the date
::LogFileExt is the extension to be used
::First get the date into a variable. Then convert the '/' to '-' so
::the '/' won't be mistaken as a command line switch
::if the file exists, a blank line and a separator line of equal signs
::will be written at the end of the file in case the script runs more than
::once a day.
::::::::::::::::::::::::::::::::::::::::::::::::::::
setlocal
set LogPath=C:\Logs\
set LogFileExt=.log
set LogFileName=Test Backup%LogFileExt%
::use set MyLogFile=%date:~4% instead to remove the day of the week
set MyLogFile=%date%
set MyLogFile=%MyLogFile:/=-%
set MyLogFile=%LogPath%%MyLogFile%_%LogFileName%
::Note that the quotes are REQUIRED around %MyLogFile% in case it contains a space
If NOT Exist "%MyLogFile%" goto:noseparator
Echo.>>"%MyLogFile%" 2>&1
Echo.===================>>"%MyLogFile%"
:noseparator
echo.======== Starting Delete ======== >>"%MyLogFile%"
echo.%Date% >>"%MyLogFile%"
echo.%Time% >>"%MyLogFile%"
:startbatch
C:\Progra~1\FastCopy\FastCopy.exe /cmd=delete /speed=full /error_stop=FALSE /no_confirm_del /force_close "Y:\Critical"
Echo.======== Delete Complete ========>>"%MyLogFile%"
echo.%Date% >>"%MyLogFile%"
echo.%Time% >>"%MyLogFile%"
Echo.======== Starting Daily Critical File Backup to ACNNas1 ========>>"%MyLogFile%"
C:\Progra~1\FastCopy\FastCopy.exe /cmd=force_copy /filelog="%MyLogFile%" /speed=full /error_stop=FALSE /force_close /acl=FALSE /verify=TRUE /balloon(=FALSE) "D:\Qbooks" /to="Y:\Critical\Qbooks"
Echo.======== Backup Complete ========>>"%MyLogFile%"
echo.%Date% >>"%MyLogFile%"
echo.%Time% >>"%MyLogFile%"
:::::::::::::::::::::::::::::::::::::::::::::::::::::::
endlocal
If I run this batch file manually, it works fine without any errors. When I try to run it using the Task Scheduler, it fails to execute either of the FastCopy commands (won't delete nor will it copy). It had previously worked without a problem and then last week it started failing. There were no updates on the server last week. This is running on MS Server 2008 R2 (part of SBS 2011).