Task Scheduler with Batch file

Ksean
Ksean used Ask the Experts™
on
Hello,
I have a batch file(*.bat) to run with Task Scheduler but I am getting error as below

Event ID 203
Task Scheduler failed to launch action "c:\windows\system32\cmd.exe" in instance

I have tried a couple of things but it still doesn't work

Thanks in advance
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Does the batch file run successfully when executed manually?

Then, in the section of task scheduler I also check the box "Run with highest privileges", though I don't know whether that would be necessary in your case.
Is this vista?

If the event id is 203, is the Error Value: 2147942667?

If so, then

Error code 2147942667 indicates that the directory name is invalid. In most cases, this is caused by placing quotes around the "Start In" directory.

Resolution?

Remove the surrounding quotes from the "Start In" path.

The path of the program to launch must be surrounded by quotes if it contains spaces; the "Start In" path must not be surrounded by quotes.
CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

Author

Commented:
manually no problem. and also it is on windows 2008 server.

I do not have anything in Start in. Do I have to put anything?

batch file (file.bat) is in c:\program files\backup\backup.bat

When I put one command in program/script, no problem

but the batch file has many command inside.

Thanks
If you could, could you please upload your batch file for me to see?

Author

Commented:
Here you are

@echo on
SETLOCAL ENABLEDELAYEDEXPANSION
set JavaCmd1=Java -classpath . ServiceStat bodeans 3306
set JavaCmd2=Java -classpath . ServiceStat scandal 80
set JavaCmd3=Java -classpath . ServiceStat scandal 389
set DOSCmd=DIR C:\Windows

Set Counter=1
set Result=
 
:Loop
for /f "tokens=1" %%a in ('!JavaCmd%Counter%!') do set Result=%Result%%%a

echo %Result%|findstr /i "yesyesyes"
if not errorlevel 1 GOTO DOCOMMAND

echo %Result%|findstr /i "errorerrorerror"
if not errorlevel 1 goto :EOF
 
echo %Result%|findstr /i "nonono"
if not errorlevel 1 goto :EOF
 
echo %Result%|findstr /e /i "no"
if not errorlevel 1 (
    echo %Time% started waiting 5 minutes...
    ping -n 300 loopback
    goto Loop
)
 
echo %Result%|findstr /e /i "yes"
if not errorlevel 1 Set /a Counter+=1
if %Counter% LEQ 120 goto Loop
goto DOCOMMAND
 
:DOCOMMAND
sc start glassfishDomain1
GOTO :EOF

Task Scheduler says it is running  but I never see dos windows that shows it is running

Thanks
try echoing out to a text file to gauge progress while it's running.

Author

Commented:
netcmh,
Thanks for your help.
I just found solution myself. If I use option called "create basic task" instead of "create task", it just works
There may be some permission or security issues even though I used administrator for this task.
Thanks anyway

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial