Forum Discussion

chuckmi's avatar
chuckmi
Copper Contributor
Oct 30, 2024

Cannot run batch file in Task Scheduler which runs Python program.

I have Windows 10, we have a network and I log into my laptop with a network Active Directory userid.

I have Task Manager v1.0. No idea why the version is so low for Windows 10.

 

When I run a simple batch file called test.bat: 

 

echo This is a test >> "C:\Users\MYUSER\OneDrive - COMP\Documents\PythonProjects\COMP\Test\Proforma\logtest.txt"

 

 

It runs fine. 

 

But when I run another batch file called godailyauto.bat in the same directory, which calls a Python program, I get this error:  

 

"Task Scheduler failed to start "\crProformaTest" task for user "COMPANY\MYUSER". Additional Data: Error Value: 2147942667."

 

I have the task:

  1. Set to use my username and only run if I am logged on, to reduce potential problems. 
  2. It is not set to run with Highest Privileges. I tried that and it didn't work either. 
  3. On the Task Settings tab I have checked "Allow task to run on demand". The task starts but gets an error. 

 

How do I get godailyauto.bat to run properly from Task Scheduler? 

Do I need to install updates for Windows Task Scheduler? 

 

Thank you.

 

1 Reply

  • ElliottHayes's avatar
    ElliottHayes
    Iron Contributor

    Running a batch file that launches a Python program via Task Scheduler on Windows 10 can sometimes be tricky, especially in a networked environment with Active Directory (AD) login. Also, the version of Task Manager isn't directly relevant to the issue—it's just a UI for process management, and Windows 10's Task Manager has been updated over time.

Resources