why windows 7 task scheduler task fails with error 2147942667

I had this same issue.

The solution for me was found in the Microsoft KB Article 2452723:

Windows Vista onwards scheduled tasks fail to run if the path in "Start in (Optional)" field has quotes

Basically, edit your scheduled task and take the Quotes out of the Start In field:

  1. Open your Scheduled Task
  2. Switch to "Actions" tab
  3. Open your Action
  4. Remove Quotes (") from the field "Start in (optional)"
  5. Save and close all open dialogs

Edit Action Dialog Box

To get the relevant error message:

1) Convert 2147942667 to hex: 8007010B
2) Take last 4 digits (010B) and convert to decimal: 267
3) Run: net helpmsg 267
4) Result: "The directory name is invalid."

Command Prompt Window


For me it was the "Start In" - I copied the values from an older server, and updated the path to the new .exe location, but I forgot to update the "start in" location - if it doesn't exist, you get this error too

Quoting @hans-passant 's comment from above, because it is valuable to debugging this issue:

Convert the error code to hex to get 0x8007010B. The 7 makes it a Windows error. Which makes 010B error code 267. "The directory name is invalid". Sure, that happens.


This can happen for more than one reason. In my case this happened due to a permissions issue. The user that the task was running as didn't have permission to write to the logs directory so it failed with this error.