.bat runs from command line but not when scheduled

1

I've got a 1-line batch file that runs a pantaho etl job. It works fine when I run it from command line or gui, but the process doesn't even start when it's scheduled. I have the following settings:

-Run whether user is logged on or off (Do not store password is NOT checked)

-Run with highest privelages

-Trigger is set to 'daily' and 'Enabled' check box is active

-Action is 'Start a program'

-Program/script: The absolute location of my .bat file

-Add arguements is blank

-Start in is the folder where the file is located.

-Nothing is checked on the 'Conditions' tab

The history shows this, that the task goes through all steps in the same moment:

Level   Date and Time   Event ID    Task Category   Operational Code    
Information 6/10/2013 10:47:00 AM   102 Task completed  (2) 
Information 6/10/2013 10:47:00 AM   201 Action completed    (2) 
Information 6/10/2013 10:47:00 AM   129 Created Task Process    Info    
Information 6/10/2013 10:47:00 AM   200 Action started  (1) 
Information 6/10/2013 10:47:00 AM   100 Task Started    (1) 
Information 6/10/2013 10:47:00 AM   319 Task Engine received message to start task  (1) 
Information 6/10/2013 10:47:00 AM   107 Task triggered on scheduler Info    

The scheduler's history tells me the task has been successfully completed with return code of 1.

Thanks for any suggestions.

user1810434

Posted 2013-06-10T15:00:39.857

Reputation: 167

1A return code of 1 means the task exited with a non-zero results - which usually means some kind of error occurred when the program ran. – martineau – 2013-06-10T15:08:52.280

@martineau, I've tested several times by running it from the command line and from the GUI. Success is reported and the database records are updated appropriately. – user1810434 – 2013-06-10T15:29:11.990

You say: "nothing is checked on the 'Conditions' tab" - try checking these two options: Start the task only of the computer is on AC power and Stop if the computer switches to battery power. I have those two checked and mine runs automatically. – Kevdog777 – 2013-06-10T15:52:04.340

Also, you don't need the Start in (optional) field (in Actions) - as the program will be set in the Programs/script field. – Kevdog777 – 2013-06-10T15:56:39.863

When you say it runs from command line, are you launching the .bat file from the command line or are you typing the 1-line command in the command line/GUI? I recall variable names being different between a windows CMD line and in a batch file (one '%' versus two '%%'s for instance), so you might be mindful of that if yours uses those. – panhandel – 2013-06-10T15:59:57.020

@panhandel, I can run it either by typing the command or by entering the filename.bat at the prompt. There are no variables. – user1810434 – 2013-06-10T16:09:37.240

1user1810434: I know that, I read your question. The point I was trying to make was that the program is encountering an error of some kind when run from the Task Scheduler. If you can figure out what that error is, then you may be able to correct it. – martineau – 2013-06-10T17:48:14.903

You say that the program/script is specified (in the Task Scheduler) as the absolute location of your .BAT file (let’s call it foo.bat).  Try saying cmd /c …\foo.bat. – Scott – 2013-06-10T19:00:24.937

No answers