1

I am trying to schedule a task using Task Scheduler on Windows. It is for a console app written with .net Core. I have created a task, set a trigger and created a new action.

When I manually run it, I get a 'Last Run Result' of 'The system cannot find the file specified. (0x80070002)'. I have ensured that the user account running the task has access to the database on SQL Server.

I ran it in the command line as dotnet "C:\Program Files\UTDT_Database_Update\publish\UTDT_Database_Update.dll" and it worked successfully.

My 'Edit Action' is as follows.

Program/Script: dotnet

Add arguments (optional): UTDT_Database_Update.dll

Start in (optional): C:\Program Files\UTDT_Database_Update\publish\

I haven't found any solutions that work yet. Anyone have any ideas?

TylerH
  • 20,799
  • 66
  • 75
  • 101
Dan
  • 174
  • 1
  • 2
  • 11
  • can you try putting path in "" for example: "C:\Program Files\UTDT_Database_Update\publish\" in start in of task as path contains space in it. – Chaturvedi Dewashish Apr 25 '19 at 15:11
  • Thank you for the response. I have tried that but it returns **Directory Name is Invalid**. I googled that error and it found that Start in (optional) field doesn't support quotes. The user said it worked for him without quotes. – Dan Apr 25 '19 at 16:11

1 Answers1

0

Solution was to create a batch file (.bat) that contained the following:

@ECHO OFF dotnet "C:\Program files\UTDT_Database_Update\publish\UTDT_Database_Update.dll"

Program/Script: UTDT_Database_Update_batch.bat

Add arguments: empty

Start in: Location of .bat file

This made it run. Still not sure why original task didn't work but this at least gets it to run.

TylerH
  • 20,799
  • 66
  • 75
  • 101
Dan
  • 174
  • 1
  • 2
  • 11