Computer is a member server running Windows 2003 SVR in an Windows SBS domain.
I have scheduled a simple batch file to run in Windows Schedule Task using the domain\administrator account.
The batch file runs the XCOPY and FORFILES utilities. Objective is to use FORFILES to clean up prior to using XCOPY to backup remaining files to a network share.
It contains the following lines
FORFILES -pR:\EXACT\009 -s -m*.* -d-5 -c"CMD /C del @FILE" > filelogr.txt
xcopy "D:\SQL\GoodHealth\MSSQL\BACKUP\009\*.bak" "\\Pc-store\Raid-Backup\Exact\009\" /D /C /F /Y > synclogr.txt
The batch file runs as scheduled. XCOPY works as expected. However, FORFILES fails. The error is that R:\EXACT\009 is not a valid directory. R: is a mapped drive.
But when I run the same batch file whilst logged on as domain\admnistrator, both runs successfully. FORFILES only fails when I run it via the Windows Scheduler.
I have tried using UNC instead of the mapped drive R:. When I did that, FORFILES complained about not supporting UNC.
Any trouble-shooting advice and suggestions would be gratefully received.