locked
Task Schedular wont run .bat file RRS feed

  • Question

  • Hi,

     

    We have recently just started upgrading our servers to 2008 R2 and I have just started to setup SQL Server on our new 2008 r2 machine. I have copied the .bat file we used to do the SQL backups before and then made some changes to make it work on the new server. If I run the script manualy it works fine and gives no errors. However I have tried to setup a scheduled task to run this script every night but the Script does not run. I have found out that the task schedular will only run batch scripts properly if the task is set to run only when the user is logged on. I can now get the script to run but it gives the following error:

    C:\Windows\system32>.\ExpressMaint2008.exe -S Lee\Arch -U sa -P SQL123fidd -D AL
    L_USER -T DB -B "G:\Database Backups\Arch" -R "G:\Database Backups\Arch"-BU DAYS
    -BV 2 -RU WEEKS -RV 2 -C -BF $(DATE)_$(DB)
    '.\ExpressMaint2008.exe' is not recognized as an internal or external command,
    operable program or batch file.

     

    I never get this error if I run the batch file manually.

    Tuesday, June 28, 2011 8:23 AM

Answers

  • Just to let you all know I have solved this now. The problem was if I run the script through task manager I need to give the full file path to the .exe were as I was using ./%File name%.

     

    Matt

    • Marked as answer by Rick Tan Wednesday, June 29, 2011 7:18 AM
    Tuesday, June 28, 2011 2:55 PM