Author Topic: Script Refuses To Run  (Read 5270 times)

radioman54

  • Newbie
  • *
  • Posts: 41
Script Refuses To Run
« on: July 19, 2014, 10:23:44 am »
I have two scripts that are virtually identical that are started as a scheduled task. One of the scripts run every time but the second script only runs occasionally.

The script that always runs is:

ErrorMode(@Off)
WinHide("")
SystemStatus = IniReadPvt("System Status","Status","Home","WinBatch.ini")
If SystemStatus == "Home" Then
   IniWritePvt("StartUp Status","Status","Backup","WinBatch.Ini")
   IntControl(67,0,1,0,0)
EndIf

Return

And the script that rarely runs is:

ErrorMode(@Off)
WinHide("")
SystemStatus = IniReadPvt("System Status","Status","Home","WinBatch.ini")
If SystemStatus == "Home" Then
   IntControl(67,0,1,0,0)
EndIf

Return

Both scripts are compiled with the same parameters (just a standard compile).

The error generated for the script that does not load is:

Log Name:      Microsoft-Windows-TaskScheduler/Operational
Source:        Microsoft-Windows-TaskScheduler
Date:          7/19/2014 5:05:00 AM
Event ID:      103
Task Category: Action start failed
Level:         Error
Keywords:      (1)
User:          Desktop\C.B. McCoy
Computer:      Desktop
Description:
Task Scheduler failed to start instance "{a359e455-d793-4712-aafe-c23e770a2832}" of "\Restart System"  task for user "Desktop\C.B. McCoy" . Additional Data: Error Value: 2147942667.
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
  <System>
    <Provider Name="Microsoft-Windows-TaskScheduler" Guid="{DE7B24EA-73C8-4A09-985D-5BDADCFA9017}" />
    <EventID>103</EventID>
    <Version>0</Version>
    <Level>2</Level>
    <Task>103</Task>
    <Opcode>102</Opcode>
    <Keywords>0x8000000000000001</Keywords>
    <TimeCreated SystemTime="2014-07-19T09:05:00.207099600Z" />
    <EventRecordID>36035</EventRecordID>
    <Correlation ActivityID="{A359E455-D793-4712-AAFE-C23E770A2832}" />
    <Execution ProcessID="10596" ThreadID="10632" />
    <Channel>Microsoft-Windows-TaskScheduler/Operational</Channel>
    <Computer>Desktop</Computer>
    <Security UserID="S-1-5-21-1935992125-1252778154-3811053173-1001" />
  </System>
  <EventData Name="TaskFailureEvent">
    <Data Name="TaskName">\Restart System</Data>
    <Data Name="InstanceId">{A359E455-D793-4712-AAFE-C23E770A2832}</Data>
    <Data Name="UserContext">Desktop\C.B. McCoy</Data>
    <Data Name="ResultCode">2147942667</Data>
  </EventData>
</Event>

Any ideas why the second script only loads sometimes? In the past month (since June 15) it has loaded 5 times (it runs daily) and failed (with the same error) every other day.

td

  • Tech Support
  • *****
  • Posts: 3210
    • WinBatch
Re: Script Refuses To Run
« Reply #1 on: July 21, 2014, 06:47:00 am »
The "ResultCode" error maps to the system error "The directory name is invalid."  Do you have quotes around the Start-in directory name?  That has been reported to be one cause of this error but there may be other causes.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

radioman54

  • Newbie
  • *
  • Posts: 41
Re: Script Refuses To Run
« Reply #2 on: July 21, 2014, 09:01:56 pm »
Yes, the directory is in quotes.

etippelt

  • Newbie
  • *
  • Posts: 42
Re: Script Refuses To Run
« Reply #3 on: July 22, 2014, 01:37:11 am »
Put in a small delay in the script that does not run reliably, in the place where the other script has the INIWrtPvt command.  Such a marginal difference makes me suspect a potential timing issue.  Another thing you could try would be to log every operation to a logfile to see what exactly is going on, and how paths are being resolved.
Using Winbatch since 1995. Excellent tool, awesome support always.

td

  • Tech Support
  • *****
  • Posts: 3210
    • WinBatch
Re: Script Refuses To Run
« Reply #4 on: July 22, 2014, 06:38:02 am »
Yes, the directory is in quotes.

According to several post on MSFT forms it should NOT be in quotes as quotes cause the error.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

radioman54

  • Newbie
  • *
  • Posts: 41
Re: Script Refuses To Run
« Reply #5 on: July 26, 2014, 08:44:30 pm »
Put in a small delay in the script that does not run reliably, in the place where the other script has the INIWrtPvt command.  Such a marginal difference makes me suspect a potential timing issue.  Another thing you could try would be to log every operation to a logfile to see what exactly is going on, and how paths are being resolved.

What's the point of trying to log anything from the script when the script doesn't load?

etippelt

  • Newbie
  • *
  • Posts: 42
Using Winbatch since 1995. Excellent tool, awesome support always.