Gina Gina
Gina Gina

Reputation: 3375

Batch file runs manually but not through Windows 10 Task Scheduler

I really need help on running a .bat file from the Task Scheduler.

It runs when ran from location or when Run is clicked from Task Scheduler.

It doesnt run on a schedule when Run only when user is logged on / Run when user is logged on or not

The user is my local account is also the admin

.bat file is stored in C:\Users\user1\eclipse-workspace\abc\, and this is what iI have filled in for the Program/Script under Settings in Actions tab.

I have unchecked all options under Conditions tab, (tried checking the power options, still didnt work).

I would prefer to have this option set :: Run when user is logged on or not.

I would like to know what I'm missing or where I'm going wrong with this.

.bat file code is :

cd C:\Users\user1\eclipse-workspace\abc
set ProjectPath=C:\Users\user1\eclipse-workspace\abc
echo %ProjectPath%
set classpath=%ProjectPath%\bin;%ProjectPath%\Lib\*
echo %classpath%
java org.testng.TestNG %ProjectPath%\testng.xml
pause

Upvotes: 1

Views: 4635

Answers (1)

anish
anish

Reputation: 88

This one saved me:

  • Make sure "Run with highest privileges" is turned off in your task scheduler settings
  • In your bat file, use pushd \\network_drive_name as the first line of code
  • At the end of your bat file, use popd \\network_drive_name

Upvotes: 0

Related Questions