3

I am able to run a .exe from the command line, but when I try and run it using the Task Scheduler, I get the error "The system cannot find the path specified. (0x80070003)"

I am running this on a server, so I have tried mapping the drive and also using the full path. Both of these methods work using the command line.

This is how I have the Program/script set to run:

D:\scripts\lilt\NewFile.exe \err00\root\LILT\ILL\ \pcc02\Inter\I040\ILL\Inbox\"

What do I need to do, to get this to run on the scheduler? Thanks!

jodies
  • 217
  • 1
  • 6
  • 17
  • What user account is the task running under? – Chris Fannin Apr 12 '16 at 16:02
  • @ChrisFannin I'm using the admin account. I have used this account to successfully run all the other tasks currently on the server. Thanks. – jodies Apr 12 '16 at 16:41
  • That error is `PATH_NOT_FOUND`, so apparently the account that the task is running under does not see that drive or directory. – Ken White Apr 12 '16 at 17:07
  • You mention mapping the drive. Is there any reconnect latency or the like happening? I have had that happen way too many times, and it causes applications to think it can't be found when it's just that Windows keeps choking on it. If you want to test it, you can write a BAT file to check for the existence of each part and output the results to a text file. Then, you can configure it as a task to run against `cmd.exe` to see what happens. – Chris Fannin Apr 12 '16 at 17:10
  • When you say `I am running this on a server` do you mean that the task is scheduled on the server's task scheduler, or you're trying to run an executable that is found on a server? – TriskalJM Apr 12 '16 at 17:24
  • @TriskalJM Both. The scheduler is running an executable that is found on that server. The .exe runs perfectly from the command line, but it won't work from the task scheduler. – jodies Apr 12 '16 at 18:51
  • @KenWhite I'm using the same account to run the .exe from the command line, so I'm not sure why it wouldn't be found when I move it to the task scheduler. Any insight? – jodies Apr 12 '16 at 18:52
  • See [How do I set a Windows scheduled task to run in the background?](http://stackoverflow.com/questions/6568736/how-do-i-set-a-windows-scheduled-task-to-run-in-the-background). This seems to also be a non-programming question. – Sam Hobbs Apr 12 '16 at 19:00
  • @user34660 - I will investigate that, but I do not need it to run in the background. I just need it to run on the scheduler. Thanks. – jodies Apr 12 '16 at 19:02
  • @user34660 - I'm afraid that didn't work – jodies Apr 12 '16 at 19:21
  • Can you try using UNC path instead of a drive mapping? – TriskalJM Apr 12 '16 at 19:57
  • @TriskalJM - I was able to resolve the issue by using the "Add Arguments line". Thanks for you help with this. :) I posted my answer for others in case they have the same issue. – jodies Apr 12 '16 at 20:04

1 Answers1

1

I figured it out. I had to use the "Add arguments (optional)" section to indicate the drives and not put it in the Action line. (As some history, I'm moving this task from a PC to a server, and the PC had it all in the one line, as well, when running from cmd on the server, I could execute it successfully on one line, but it behaves differently once you make it a task apparently.

So this went in "Action":
D:\scripts\lilt\NewFile.exe

And this went in Add arguments (optional): \err00\root\LILT\ILL \pcc02\Inter\I040\ILL\Inbox

jodies
  • 217
  • 1
  • 6
  • 17
  • 1
    Yeah, that's the proper way to do it. For example, I have a manually executed task that opens the developer prompt in my project folder. The "Program/script" is set to `%windir%\System32\cmd.exe`, the "Add arguments" is `/c start "%cd%" "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall.bat"`, and the "Start in" is `C:\path\to\my\trunk`. When I look at it in details, it combines it all together as `%windir%\System32\cmd.exe /c start "%cd%" "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall.bat"` – Chris Fannin Apr 12 '16 at 20:32