1
votes

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
1
In the 'Start In' field put the filepath C:\Users\user1\eclipse-workspace\abc\ Then in the Program/Script put just the name of the bat file without the path. Let me know if that works for you.DrHouseofSQL
already tried that, but it didnt workGina Gina
Under security options have you tried enabling the 'Run with highest privileges' option?DrHouseofSQL
The only other thing to try (odd as it may seem) is to toggle the 'Configure for' dropdown setting on the General tab. Try all the selections and see if one works.DrHouseofSQL
This site is for help with your code issues, if you're not providing code, your question is off topic, _and would have been better on Super User, where general questions regarding the use of the OS software belong.Compo

1 Answers

0
votes

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