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.
82 thoughts on “Windows Task Scheduler: The directory name is invalid. (0x8007010B)”
I was banging my head against Task Scheduler for ages until I came across this post.
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.
Thanks .. i have been looking for solution for 2 days ..
Thanks, just like others I have been banging my head on this. Windows just sucks. Cronjobs are so better and easier on linux.
THANKS for taking the time to write this post 🙂
I was about to give up.
2.5 days working on this !!!!! I was about to give up !!!! and finally Google got me here to read your blog !!!!
Thank you for your time in drafting this. It is much appreciated by this win7 noob.!. 🙂
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 :(.
Just wanted to add my thanks – easy solution to something which was really causing me a headache!
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.
Another useful suggestion is to ensure that you always run the “Task Scheduler” in the administrator mode before creating a task.
Excellent. Thanks for posting!
Your tip was very useful for me too.
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!
Thank you very much for illuminating one of Microsoft’s gabillion absurdities. Helped me greatly today.
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.
Start in C:\Program Files (x86)\Trillian
Save exit, and right click to run the program. Task scheduler should report operation successful.
Absolutely helpful! Thank you! Keep up the good work!
Thanks! Did the trick.
The bugs we need to workaround whilst using Windows…
Thanks – This article saved me quite some time!
Thx for this, absolutely helpful
Thank you – wouldn’t have dreamed that the spaces in the path would be handled correctly so you saved me a ton of time.
Cheers buddy, helped me out with a group policy scheduled task 🙂
Awesome, fixed my issue – THANKS.
Thanks, would have never figured that out on my own!
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.
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.
Thanks for the info. Fixed my issue. Was going crazy trying to figure what’s wrong with the scheduled task..
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)
Really a nice tutorial!!!!!
Thanks a lot 🙂
Thanks. Your solution bubbled up to the top of the Bing results. Saved a lot of time.
Thank you so much. This was driving me crazy…
Thanks, A RI GA TO.
I was only working on this for hours before I found your post. Thanks so much.
Add me to the list of people this post helped!!
This solution is very helpful.
And me. How ridiculous to allow/require quotes in one field of the form, but disallow them on another! Grrr!
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!
Thank you for your time in posting this. Fixed my issue as well.
Thanks. Saved a lot of time..!
+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.
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.
Ridiculous!! Thanks for this tip. Micro shafted again!
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.
I was trying to run a command with the following syntax
i get the error that the path cannot be found. are we not able to use wildcards to specify the location of the logonserver?
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.
There must be another cause as well, because I have that error now and I have no quotation marks in my “Start In” field.
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.
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.
this exception also comes when executing user account does not access to appropriate directory.
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!
Thanks Matt!! I was about to go nuts trying to figure this out. Nothing else I tried worked. But this did!!
Thank you so much! Solved my problem right away.
6 years old, and still a helpful article.
Thank you Matthew, you saved me from banging my head for another few hours 🙂
Thanks you. It works.
Thanks! funny it accepts quotes in the program location box but not in the working directory.
I am following the steps and it keep giving e error 0x1
All this time later and you are still helping folks out! Thanks!
Super helpful – thank you!
I and my sanity thank you
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!
“C:\Program Files (x86)\Origin Games\Command and Conquer Generals Zero Hour\Generals.exe”
C:\Program Files (x86)\Origin Games\Command and Conquer Generals Zero Hour
This did not have any effect on the same bug for me, Win7.
In 2017, it save my say.
thank you! In windows 10 they still didn’t solve this…
This article is still solving problems. Thanks!
This Work..Thanks You SO Much
Same error, but I’ve never had quotes in the path, and the path without question is correct.
Thanks your post helps!
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
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