Task Scheduler error code 5 with .bat

Posted on 2013-11-26
Last Modified: 2013-11-28
Hello, I created a Task to execute a batch file and I get en error code 5 after the execution.
I have a WS2008 R2 64 bits
When I just clic on the batch file, it execute fine, but when I program a task it doesn't execute.
Here is the batch :

@echo off
htmltools.exe -webkit "®ion=alpes&pays=france&lang=fr" E:\docv8\lad\SKIPLAN\multi\Sybelles.pdf

Here is the Result from the event log in XML :

Nom du journal :Microsoft-Windows-TaskScheduler/Operational
Source :       Microsoft-Windows-TaskScheduler
Date :         26/11/2013 18:49:26
ID de l’événement :201
Catégorie de la tâche :Action terminée
Niveau :       Information
Mots clés :    
Utilisateur :  MMP\rexrotary
Ordinateur :   SRVBUCO3.mmp.local
Description :
Le Planificateur de tâches a terminé la tâche « \HTMLTOOLS », instance « {c2cd0bd3-0612-4c49-9981-132d56883394} », action « C:\Windows\SYSTEM32\cmd.exe » avec le code de retour 5.
XML de l’événement :
<Event xmlns="">
    <Provider Name="Microsoft-Windows-TaskScheduler" Guid="{DE7B24EA-73C8-4A09-985D-5BDADCFA9017}" />
    <TimeCreated SystemTime="2013-11-26T17:49:26.799517500Z" />
    <Correlation ActivityID="{C2CD0BD3-0612-4C49-9981-132D56883394}" />
    <Execution ProcessID="5292" ThreadID="4076" />
    <Security UserID="S-1-5-21-2231089222-1738138904-3927364064-1837" />
  <EventData Name="ActionSuccess">
    <Data Name="TaskName">\HTMLTOOLS</Data>
    <Data Name="TaskInstanceId">{C2CD0BD3-0612-4C49-9981-132D56883394}</Data>
    <Data Name="ActionName">C:\Windows\SYSTEM32\cmd.exe</Data>
    <Data Name="ResultCode">5</Data>

Could you help me, I searched for all day but I couldn't fix it
Question by:mdmmp
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 6
LVL 14

Expert Comment

ID: 39679539
change the action of the task to the the path of the batch file as in the image below instead of cmd.exe (looks like it has been blocked for security purposes)


Author Comment

ID: 39680021
Hello,I tried this, but the task never end.
ImageThe lines are :
Program : C:\Windows\SYSTEM32\cmd
Arguments : htmltools.exe -webkit "®ion=alpes&pays=france&lang=fr" E:\docv8\lad\SKIPLAN\multi\Sybelles.pdf exit
Start in  : E:\HTMLTOOLS\

I also tried this :
ImageBut there is still the same error

Here is the rest of the task :
LVL 14

Expert Comment

ID: 39680024
are the arguments : htmltools.EXE or htmltools.CMD ?
is that incorrect?
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 39680078
the executable of the application is htmltools.exe
and my .bat file is htmltools.cmd

LVL 14

Expert Comment

ID: 39680382
is e: a local or shared?

try having a look in the event log for any logs relating to the scheduled task

Author Comment

ID: 39680522
E: is a local hard drive
I attached the log files in csv format and txt format
LVL 14

Expert Comment

ID: 39680792
try creating the task with

program: E:\HTMLTOOLS\htmltools.exe

arguments: -webkit "®ion=alpes&pays=france&lang=fr" E:\docv8\lad\SKIPLAN\multi\Sybelles.pdf

program: E:\HTMLTOOLS\

Author Comment

ID: 39681440
I have still the same error, here are the screenshot and the Csv file
LVL 14

Accepted Solution

brendanmeyer earned 500 total points
ID: 39682580
try, setting it to run only when the user is logged on , log on as that user. and run the task, check if it works

if its still the batch file,
put pause instead of exit so you and see the output

other than that, i am running out of things that it could be

Author Comment

ID: 39683238
It works with the user login
And when it open the DOS Windows, I could see that the product is not registered for this user !
So I have toregister the htmltools.exe for the user I run the task on.
Tanks for help, I could fin out what was going on

Author Closing Comment

ID: 39683239
It help me to fin what the problem was
LVL 14

Expert Comment

ID: 39683309
Glad I could have been some help

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SRV.SYS Causing Server Crash During Backup 11 47
Delete Files Recurse - Powershell Script 3 66
Windows server 2008 exchange 3 25
Unable to hit site 2 30
To effectively work with Diskpart on a Server Core, it is necessary to write some small batch script's, because you can't execute diskpart in a remote powershell session. To get startet, place the Diskpart batch script's into a share on your loca…
I had a question today where the user wanted to know how to delete an SSL Certificate, so I thought that I would quickly add this How to! Article for your reference. WHY WOULD YOU WANT TO DELETE A CERTIFICATE? 1. If an incorrect certificate was …
This tutorial will walk an individual through the steps necessary to install and configure the Windows Server Backup Utility. Directly connect an external storage device such as a USB drive, or CD\DVD burner: If the device is a USB drive, ensure i…
This tutorial will walk an individual through setting the global and backup job media overwrite and protection periods in Backup Exec 2012. Log onto the Backup Exec Central Administration Server. Examine the services. If all or most of them are stop…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question