For a given task I need to determine what file it is trying to run with a batch code. Currently I use schtasks /query /TN ITCMD-CHAT-NOTIF | find "Ready" to determine if the task is active, but I see no way to determine what file it is executing. Is it possible?

  • If you add /v to the run string (schtasks /query /v /TN ITCMD-CHAT-NOTIF), one of the fields contains the schedule string, though it is limited to 50 characters.
    – AFH
    Sep 28, 2018 at 17:56
  • Add a /v and remove the pipe with find and instead pipe it to a file, then please click edit above and add the result, so we can see more of what's going on.
    – K7AAY
    Sep 28, 2018 at 17:56

1 Answer 1


To find the full path of the file being run, you can use the /XML switch and FIND "<Command>".

This gives you the XML file you would get if you exported the task, so you can't get both the Status and the Command fields using this command. Instead, you could create a batch file that will run both commands.


schtasks /query /TN %1 | find "Ready"
schtasks /query /TN %1 /XML | find "<Command>"

You can then run task_status.bat ITCMD-CHAT-NOTIF to get both fields of the task.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .