I created a tasks in the task scheduler called VS2010R which opens devenv.exe on demand. I've tested it from the task scheduler and it runs fine. However, I am unable to run this task from the command window.

When I input:

C:\Users\mini>SCHTASKS /RUN /TN "VS2010R"

I get: ERROR: The system cannot find the file specified.

I have tried everything I could think of with no success. Anyone have a suggestion?

Dani AI

Generated

Quick summary: the error you saw is often caused by referencing the task by name only when the task actually lives in a subfolder of the Task Scheduler Library, or by the task’s action pointing to an executable path that the scheduler cannot access. As hinted, the scheduler needs a fully resolved target; as discovered, including the task’s folder path fixes the “cannot find the file specified” case where the task itself wasn’t found.

What to check (practical, in-order):

  • Confirm the task’s exact location in Task Scheduler (Task Scheduler Library and any subfolders) and use that path when invoking the task from the command line.
  • Open the task’s Actions tab and make sure the Program/script field contains the absolute path to the executable (no relative paths or missing environment-variable expansions). Also confirm the Start in field if the program requires a working directory.
  • Verify the task’s security options: the account it runs as must have access to the executable (network locations and per-user profiles can fail). If the task requires elevation, run the invoking prompt as Administrator.
  • Inspect the Task Scheduler Operational log in Event Viewer (Applications and Services Logs → Microsoft → Windows → TaskScheduler → Operational) for precise error messages when the run fails.

If the task still won’t start from the command line, recreate it with absolute paths and explicit start directory, or run a quick manual test of the executable under the same account used by the task to confirm permissions and path correctness.

Recommended Answers

All 2 Replies

Give it the full filepath to the executable.

schtasks.exe is the executable and it is finding that without issue. When I type

C:\Users\mini>SCHTASKS

, it runs schtasks.exe and displays all of my tasks on the console (including VS2010R). There must be something silly I am missing.

Edit: You were right. I didn't have to enter the entire pathway, but the folder that the task is stored in worked:

schtasks /run /tn myapps\vs2010r

that did the trick. thank you

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.