Here's a trivial batch:
@echo off
if not .%1==.-b goto else
echo Running with -b flag ON
goto endif
:else
echo Running with NO flags
:endif
Now, trying to run this from a scheduled task on a Windows Server 2003...
If the task is ran like: "C:\Test\test.bat" then the log (Schedlgu.txt) says:
"Test Job.job" (test.bat) Started 7/14/2010 10:27:19 AM "Test Job.job" (test.bat) Finished 7/14/2010 10:27:19 AM Result: The task completed with an exit code of (0).
However, when running like: "C:\Test\test.bat -b" then:
"Test Job.job" (test.bat -b) 7/14/2010 10:28:02 AM ** ERROR ** Unable to start task. The specific error is: 0x80070005: Access is denied. Try using the Task page Browse button to locate the application.
The task is running under the Admin account (of the domain). I have also granted full access to this user to the local cmd.exe
Any thoughts why the task fails when running a batch with one argument?
Thx