Batch script does work in Task Scheduler (Windows Server 2003) - TechRepublic
Question
March 17, 2009 at 06:12 PM
jeremy.kuek

Batch script does work in Task Scheduler (Windows Server 2003)

by jeremy.kuek . Updated 17 years, 4 months ago

I have encountered something very weird and havn’t been able to find any solutions on the net.

I’m trying to move some files over from the MYSQL 2005 database server to Windows 2003 Server. I have tried creating a batch script as follows:

—————————-
@echo off
cls
move \\116.197.144.25\Database_Backups\Ravenswood\Ravenswood2008\*.BAK F:\Database_Backup\Ravenswood
move \\116.197.144.25\Database_Backups\Ravenswood\RavenswoodCareer\*.BAK F:\Database_Backup\Ravenswood
move \\116.197.144.25\Database_Backups\Reports\*.txt F:\Database_Backup\Reports
echo on
——————————

It works fine when i run the batch script but not when run as a scheduled task. The Task Scheduler reported it run this task at the time it was manually ran and last result is 0x0, but the files didn’t appear to move at all. And the log entry shows:

“MoveRavenswoodDB test.job” (MoveRavenswoodDB.bat)
Finished 18/03/2009 11:40:58 AM
Result: The task completed with an exit code of (0).

Then I tried using xcopy as follows, the same result happened.

——————————
@echo off
cls
xcopy \\116.197.144.25\Database_Backups\Ravenswood\Ravenswood2008\*.BAK F:\Database_Backup\Ravenswood /V
xcopy \\116.197.144.25\Database_Backups\Ravenswood\RavenswoodCareer\*.BAK F:\Database_Backup\Ravenswood /V
xcopy \\116.197.144.25\Database_Backups\Reports\*.txt F:\Database_Backup\Reports /V
echo on
—————————–

I have verified that the password to run as the administrator for the scheduled task is correct. Any ideas why it didn’t work as it should be? Any help would be greatly appreciated.

Regards,
JK

This discussion is locked

All Comments