why windows 7 task scheduler task fails with error 2147942667

Windows 7Scheduled Tasks

Windows 7 Problem Overview


I am facing a strange problem. I have scheduled a task to lauch a batch file. When I run the task with option Run only when user is logged on everything works fine. but I want to run this task in background and hence i am running it using the option Run whether user is logged on or not. Now when i run the task it is not working. I get following 2 errors. I don't understand this error. Please help me resolve this issue.

 Task Scheduler failed to launch action "C:\Windows\SYSTEM32\cmd.exe" in instance "{2a7cc950-fad9-4633-9701-af75a0fd220d}" of task "\stmm\Daemon". Additional Data: Error Value: 2147942667.
 Task Scheduler failed to start instance "{2a7cc950-fad9-4633-9701-af75a0fd220d}" of "\stmm\Daemon"  task for user "GBLADHEDANI\N011940" . Additional Data: Error Value: 2147942667.

Windows 7 Solutions


Solution 1 - Windows 7

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

Solution 2 - Windows 7

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.

Solution 3 - Windows 7

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.

Solution 4 - Windows 7

I had the same problem, on Windows7.

I was getting error 2147942667 and a report of being unable to run c:\windows\system32\CMD.EXE. I tried with and without double quotes in the Script and Start-in and it made no difference. Then I tried replacing all path references to mapped network drives and with UNC references (\Server1\Sharexx\my_scripts\run_this.cmd) and that fixed it for me. Pat.

Solution 5 - Windows 7

For a more generic answer, convert the error value to hex, then lookup the hex value at Windows Task Scheduler Error and Success Constants

Solution 6 - Windows 7

For me it was the "Start In" - I accidentally left in the '.py' at the end of the name of my program. And I forgot to capitalize the name of the folder it was in ('Apps').

Solution 7 - Windows 7

For me, this was due to the user PATH environment variable, which didn't seem to work even though the user was correct, so I needed to put the entire executable path into the program field.

Solution 8 - Windows 7

For us, it was a missing ':' in the 'start in' path.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAlokView Question on Stackoverflow
Solution 1 - Windows 7jp2codeView Answer on Stackoverflow
Solution 2 - Windows 7user230910View Answer on Stackoverflow
Solution 3 - Windows 7CookalinoView Answer on Stackoverflow
Solution 4 - Windows 7Pat FahyView Answer on Stackoverflow
Solution 5 - Windows 7flymikeView Answer on Stackoverflow
Solution 6 - Windows 7Rivers CuomoView Answer on Stackoverflow
Solution 7 - Windows 7rayzinnzView Answer on Stackoverflow
Solution 8 - Windows 7Bill.FView Answer on Stackoverflow