none
Task Scheduler wont run .bat file

    Question

  • OS: Windows Server 2008 R2 SP1

    I have a .bat file that is calling a Perl script that is scheduled in the Task Scheduler and it seems to be failing.
    I can run the .bat file from the command prompt and it runs fine. But it won't run from Task Scheduler.
    Task completed Operational Code (2)

    Any idea?

    Thanks.

    Monday, August 13, 2012 7:07 PM

Answers

  • Got the issue resolved. Had to specify "Start-in (optional)" field.

    Thanks.

    • Marked as answer by TechNetKing Monday, August 13, 2012 7:25 PM
    Monday, August 13, 2012 7:25 PM

All replies

  • Return code is for app not task scheduler. I think Exit code 2 for perl is "file not found"

     

     

     


    Regards, Dave Patrick ....
    Microsoft Certified Professional
    Microsoft MVP [Windows]

    Disclaimer: This posting is provided "AS IS" with no warranties or guarantees , and confers no rights.

    Monday, August 13, 2012 7:16 PM
  • Got the issue resolved. Had to specify "Start-in (optional)" field.

    Thanks.

    • Marked as answer by TechNetKing Monday, August 13, 2012 7:25 PM
    Monday, August 13, 2012 7:25 PM
  • Glad you figured it out and thanks for sharing the solution with us.
    Tuesday, August 14, 2012 2:04 AM
    Moderator
  • i continue to have the same problem after specifying the "Start In:" parameter.

    When I execute the bat file manually in a cmd.exe window, it runs normally. When I execute it in the Task Scheduler, I get "Operational Code"="(2)", and the bat file appears to have finished partially, but failing to invoke another bat file via a call command. Task Scheduler always declares success. I have full permissions and rights and access.

    What does "Operational Code"="(2)" mean? Why does a search of this website with bing not tell me what it means?

    How about another suggestion how to fix this problem?

    Tuesday, September 03, 2013 9:28 PM
  • I'd start a new thread since this one's a year old and marked answered.

    BTW from cmd.exe net helpmsg 2

    The system cannot find the file specified.

     

     

     


    Regards, Dave Patrick ....
    Microsoft Certified Professional
    Microsoft MVP [Windows]

    Disclaimer: This posting is provided "AS IS" with no warranties or guarantees , and confers no rights.

    Wednesday, September 04, 2013 12:34 AM
  • i had the same issue, after setting the check box "run with highest privileges" then the bat file ran without issues.
    Tuesday, February 18, 2014 5:51 AM