Schedule Task fails running .bat file

Discussion in 'Windows Server' started by Kenny, Sep 21, 2005.

  1. Kenny

    Kenny Guest

    Periodically, as a backup, we like to copy the files from our web server to a
    backup web server using a .bat file. I received this message in the schedule
    task logs
    "webcopy.job" (webcopy.bat)
    Started 9/21/2005 1:30:00 AM
    "webcopy.job" (webcopy.bat)
    Finished 9/21/2005 1:30:00 AM
    Result: The task completed with an exit code of (4).

    Here is the bat file created.
    CLS
    XCOPY D:\nolhga\*.* H:\nolhga /s /y

    The job failed and I don't know what the exit code means. Can anyone help
    me out.

    Thanks.
     
    Kenny, Sep 21, 2005
    #1
    1. Advertisements

  2. Kenny

    Dave Patrick Guest

    If the job connects to another machine you may need to add the user/ group
    'logon as batch job' rights (server side). Control Panel|Admin Tools|Local
    Security Policy\Local Policies\User Rights Assignments
    "Log on as a batch job"

    Remember that if it involves network resources to make sure the user account
    has permissions to the resources and also use UNC paths as mapped drives
    won't exist when no one is logged on.


    --
    Regards,

    Dave Patrick ....Please no email replies - reply in newsgroup.
    Microsoft Certified Professional
    Microsoft MVP [Windows]
    http://www.microsoft.com/protect

    :
    | Periodically, as a backup, we like to copy the files from our web server
    to a
    | backup web server using a .bat file. I received this message in the
    schedule
    | task logs
    | "webcopy.job" (webcopy.bat)
    | Started 9/21/2005 1:30:00 AM
    | "webcopy.job" (webcopy.bat)
    | Finished 9/21/2005 1:30:00 AM
    | Result: The task completed with an exit code of (4).
    |
    | Here is the bat file created.
    | CLS
    | XCOPY D:\nolhga\*.* H:\nolhga /s /y
    |
    | The job failed and I don't know what the exit code means. Can anyone help
    | me out.
    |
    | Thanks.
     
    Dave Patrick, Sep 21, 2005
    #2
    1. Advertisements

  3. Kenny

    Ian Guest

    The exit code is from XCOPY not the scheduled task
    xcopy edxit code of 4 means:

    Initialization error occurred. There is not enough memory or disk space,
    or you entered an invalid drive name or invalid syntax on the command line.

    HTH
    Ian
     
    Ian, Sep 21, 2005
    #3
  4. Kenny

    Kenny Guest

    Thank you both for your help. It turns out that I wasn't using UNC paths and
    also, I had to add a /r switch to the Xcopy command, so I could copy
    Read-only files. It works like a charm now.

    Thanks.

    Kenny
     
    Kenny, Oct 3, 2005
    #4
  5. Kenny

    Dave Patrick Guest

    You're welcome.

    --
    Regards,

    Dave Patrick ....Please no email replies - reply in newsgroup.
    Microsoft Certified Professional
    Microsoft MVP [Windows]
    http://www.microsoft.com/protect

    :
    | Thank you both for your help. It turns out that I wasn't using UNC paths
    and
    | also, I had to add a /r switch to the Xcopy command, so I could copy
    | Read-only files. It works like a charm now.
    |
    | Thanks.
    |
    | Kenny
     
    Dave Patrick, Oct 3, 2005
    #5
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.