Windows Task Scheduler: The directory name is invalid. (0x8007010B)

Ran into an interesting little problem this morning with getting a job to run in the Task Scheduler of a Windows Server 2008 server with Service Pack 2 installed.

Every time I tried to run the job I would get the error message “The directory name is invalid. (0x8007010B)”.

In looking at the Actions for this Task the “Start in (optional)” field was filled in with the correct path name:

“C:\Program Files (x86)\BLAH\”

I thought it might be the trailing backslash problem, so I removed it.  Same error message.

Turns out it is the quotes that are causing the problem here as the “Start in (optional)” field just doesn’t support them.  Take out the quotes and your task should run just fine.  You can set this directory with or without the trailing backslash and it will still work.

Here’s what my corrected Action looks like in the Task Scheduler.

Corrected Task Scheduler Job
Task Scheduler Job with Corrected "Start In (optional)" field

82 thoughts on “Windows Task Scheduler: The directory name is invalid. (0x8007010B)”

  1. THANK YOU!

    I was banging my head against Task Scheduler for ages until I came across this post.

  2. thank you so much for this. for the past few days i’ve been racking my brain over this issue i’ve been having, and it was such a simple solution thanks to you. thanks again.

  3. Thanks, just like others I have been banging my head on this. Windows just sucks. Cronjobs are so better and easier on linux.

  4. THANK YOU
    GRACIAS !!!!

    2.5 days working on this !!!!! I was about to give up !!!! and finally Google got me here to read your blog !!!!

    Thanks!

  5. Thank you for your time in drafting this. It is much appreciated by this win7 noob.!. 🙂

  6. Greaat Post!! It was and it will be of BIG, REALLY BIG HELP for me and for a lot of tech people :).

    As usually, I been searching for the answer at Microsoft Technet site first, and as usually, they don’t have the correct solution!!. And it seems that the Windows 2008 TaskScheduler has a lot of anothers problems :(.

  7. Just wanted to add my thanks – easy solution to something which was really causing me a headache!

  8. Thank you! That was driving me nuts. You’d think they’d provide some way to notify you of that glaring inconsistency and save us all a lot of time.

  9. Thank You.

    Another useful suggestion is to ensure that you always run the “Task Scheduler” in the administrator mode before creating a task.

  10. Thank you much. I actually suspected this was the problem right from the start, so after seeing that error I tried putting in the directory name using the no-space tilda version (c:\progra~1\blahblahblah). That works at the command line, so when it didn’t work here I thought I must have been on the wrong track. Spent a bunch more time working on it without it ever occurring to me to try using the path with spaces but without quotes. Then I found your blog entry and was saved. Thankyouthankyouthankyou!

  11. Thank you very much for illuminating one of Microsoft’s gabillion absurdities. Helped me greatly today.

  12. Windows 7 may require something a little different which I figured out after reading your blog.
    Use the Browse button to find your program.
    Windows will then insert the location into the window with quotes.
    Highlight and cut the location, leaving just the program name behind.
    Paste the location into the “Start in” window.
    Remove the quotes.
    It will look like this.

    Program/Script trillian.exe
    Start in C:\Program Files (x86)\Trillian

    Save exit, and right click to run the program. Task scheduler should report operation successful.

  13. Thanks! Did the trick.

    The bugs we need to workaround whilst using Windows…

  14. Thank you – wouldn’t have dreamed that the spaces in the path would be handled correctly so you saved me a ton of time.

  15. Two years after you posted this, you are still saving the day. There’s no way I would’ve thought of removing quotes on an explicit path that has spaces on a Windows box. Great info.

  16. Thank you!!! Didn’t think the quotes would cause a problem since I left them in there for W2k3 all the time. This saved a lot of headache.

  17. Thanks for the info. Fixed my issue. Was going crazy trying to figure what’s wrong with the scheduled task..

  18. I hope this works. Been racking my brain with this for a couple months. I re-wrote my custom scripts to match what others were having issues with. Changes permissions thinking that was it. Dropped the path in the “start in” field but it had quotes so it failed. So now i removed them and I hope it works. Unfortunately i have to wait till Monday to verify because what I am doing its a once a day task and if it doesn’t run automatically someone does it manually and my files are gone (cant upload test files to an FTP server don’t have privs)

  19. Thanks. Your solution bubbled up to the top of the Bing results. Saved a lot of time.

  20. I was only working on this for hours before I found your post. Thanks so much.

  21. Excellent post.

    Microsoft should have fixed this bug.

    I got same error on Windows Server 2012.
    Waste so many hours on so many people is BAD BAD BAD!

  22. +1 for this. I thought software development meant that you made software better. M$ has made the task scheduler much less useful and more cumbersome, while keeping the bugs. Ahem.

  23. I followed the tip here, but that didn’t work.

    Another forum individual noted that they shortened the name of the script, so I did the same and now it works.

    Thanks Microsoft for your wonderful product.

    /s

  24. THANK YOU THANK YOU THANK YOU.

    Why Microsoft would use (require!) quotes in one field, and not use (break!) them in another field, ON THE SAME DIALOG BOX, is a mystery that only Microsoft will someday finally answer. In hell.

  25. I was trying to run a command with the following syntax

    %logonserver%\pathtotheEXE

    i get the error that the path cannot be found. are we not able to use wildcards to specify the location of the logonserver?

  26. I got this error too but for a different and even more inexplicable reason. I have a task configured to run a “Start a program” action with the start-in field in a network drive. This task would fail but a newly created task with the same action would succeed.

    It turned out to be the “If the task is already running, then the following rule applies” option. Changing from “Do not start a new instance” to “Stop the existing instance” allowed the task to run and cleared the “The directory name is invalid” error.

  27. There must be another cause as well, because I have that error now and I have no quotation marks in my “Start In” field.

  28. Thank you!!

    I am so glad I came across you post. I had tried removing the trailing back slash, but until reading your solution I could not figure this one out. It’s interesting the the program line has quotes, but the “Start in directory” cannot have them. I never would have figured that out.

  29. Thanks for this! I consider this a bug in Windows Scheduler. What if you have a path with spaces that needs to be the “Start in” directory?

    Anyway, thank you for coming through where windows came up short.

  30. this exception also comes when executing user account does not access to appropriate directory.

  31. Thanks for posting this article. This is the 2nd time this issue has bitten me, and this is the 2nd time that I read this article for the answer, LOL!

  32. Thanks Matt!! I was about to go nuts trying to figure this out. Nothing else I tried worked. But this did!!

  33. 6 years old, and still a helpful article.
    Thank you Matthew, you saved me from banging my head for another few hours 🙂

  34. Thanks! funny it accepts quotes in the program location box but not in the working directory.

  35. Great post, Thanks, I was playing with this for an hour this morning.

    Adding my Program/script details and Start in details as an example, it might help someone else. I love this old game!

    Program/script:
    ——————-

    “C:\Program Files (x86)\Origin Games\Command and Conquer Generals Zero Hour\Generals.exe”

    Start in
    ———-

    C:\Program Files (x86)\Origin Games\Command and Conquer Generals Zero Hour

  36. Same error, but I’ve never had quotes in the path, and the path without question is correct.

  37. This particular fix didn’t work for me, but something similar did, figured I’d share since this thread keeps helping so many people:

    The “start in” directory field doesn’t seem to work on Windows 10. Leaving it blank and including the double-quotes in the “program” field did the trick for me

  38. Bizarre. Scheduled task has worked fine for 2 years unchanged and suddenly developed this problem and had to remove the quotes to fix it! Thanks much

Leave a Reply

Your email address will not be published. Required fields are marked *

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.