0

i have a problem, created a scheduled task, to run a bat file. it's programmed to run with administrator credential, works in other tasks. the file is a normal bat file. the code inside the file is the following:

 @ECHO OFF
    REM   ------------------------------------------------------------------------------------------------------------------------

REM                             ENVIOS

REM ------------------------------------------------------------------------------------------------------------------------


IF EXIST C:\Indra\AZConnect\Export\Sonae\INVOICFF\*.* (MOVE C:\Indra\AZConnect\Export\Sonae\INVOICFF\*.* C:\Indra\AZConnect\5600000000427INT\INVOICFF\)
IF EXIST C:\Indra\AZConnect\Export\ECI\INVOICFF\*.* (MOVE C:\Indra\AZConnect\Export\ECI\INVOICFF\*.* C:\Indra\AZConnect\8422416999990INT\INVOICFF\)
IF EXIST C:\Indra\AZConnect\Export\Auchan\INVOICFF\*.* (MOVE C:\Indra\AZConnect\Export\Auchan\INVOICFF\*.* C:\Indra\AZConnect\5600000004289INT\INVOICFF\)


REM ------------------------------------------------------------------------------------------------------------------------

REM                             RECEÇÃO

REM ------------------------------------------------------------------------------------------------------------------------


IF EXIST C:\Indra\AZConnect\5600000004289INT\ORDERSFF\*.* (MOVE C:\Indra\AZConnect\5600000004289INT\ORDERSFF\*.* C:\Indra\AZConnect\Import\ORDERSFF\)
IF EXIST C:\Indra\AZConnect\5600000000427INT\ORDERSFF\*.* (MOVE C:\Indra\AZConnect\5600000000427INT\ORDERSFF\*.* C:\Indra\AZConnect\Import\ORDERSFF\)
IF EXIST C:\Indra\AZConnect\8422416999990INT\ORDERSFF\*.* (MOVE C:\Indra\AZConnect\8422416999990INT\ORDERSFF\*.* C:\Indra\AZConnect\Import\ORDERSFF\)


REM ------------------------------------------------------------------------------------------------------------------------
REM                     VALIDAÇÃO AZCONNECT EM MEMÓRIA
REM ------------------------------------------------------------------------------------------------------------------------

TASKKILL /F /IM AZCONNECT.EXE

REM ------------------------------------------------------------------------------------------------------------------------
REM                         RELATÓRIOS
REM ------------------------------------------------------------------------------------------------------------------------

IF EXIST C:\Indra\AZCONNECT\PBLIST.TXT (Type C:\Indra\AZCONNECT\PBLIST.TXT >> C:\Indra\AZCONNECT\Reports\PBLIST.txt)
IF EXIST C:\Indra\AZCONNECT\MBLIST.TXT (Type C:\Indra\AZCONNECT\MBLIST.TXT >> C:\Indra\AZCONNECT\Reports\MBLIST.TXT)
IF EXIST C:\Indra\AZCONNECT\ICONTROL*.TXT (MOVE C:\Indra\AZCONNECT\ICONTROL*.TXT C:\Indra\AZCONNECT\Reports\)

IF EXIST C:\Indra\AZCONNECT\PBLIST.TXT (del C:\Indra\AZCONNECT\PBLIST.TXT)
IF EXIST C:\Indra\AZCONNECT\MBLIST.TXT (del C:\Indra\AZCONNECT\MBLIST.TXT)

REM ------------------------------------------------------------------------------------------------------------------------
REM                          COMUNICAÇÕES EDI
REM ------------------------------------------------------------------------------------------------------------------------

REM RASDIAL INDRA <user> <pass>

START /W C:\Indra\AZCONNECT\AZCONNECT.EXE /ER

REM RASDIAL INDRA /disconnect


REM ------------------------------------------------------------------------------------------------------------------------
REM                         RELATÓRIOS
REM ------------------------------------------------------------------------------------------------------------------------

IF EXIST C:\Indra\AZCONNECT\PBLIST.TXT (Type C:\Indra\AZCONNECT\PBLIST.TXT >> C:\Indra\AZCONNECT\Reports\PBLIST.txt)
IF EXIST C:\Indra\AZCONNECT\MBLIST.TXT (Type C:\Indra\AZCONNECT\MBLIST.TXT >> C:\Indra\AZCONNECT\Reports\MBLIST.TXT)
IF EXIST C:\Indra\AZCONNECT\ICONTROL*.TXT (MOVE C:\Indra\AZCONNECT\ICONTROL*.TXT C:\Indra\AZCONNECT\Reports\)

IF EXIST C:\Indra\AZCONNECT\PBLIST.TXT (del C:\Indra\AZCONNECT\PBLIST.TXT)
IF EXIST C:\Indra\AZCONNECT\MBLIST.TXT (del C:\Indra\AZCONNECT\MBLIST.TXT)

the log file shows:

107 - task triggered
319 - received message to start task
100 - task started
129 - created task process (c:\windows\system32\cmd.exe)
200 - action started
201 - action completed
102 - task completed

but it doesn't run. any thoughts?

  • 1
    Welcome to ServerFault. How did you reach the conclusion that it did not run? The "action started" and "action completed" lines in the history log indicate that it did, indeed, run. – Doug Deden Jun 28 '19 at 19:36
  • Well, when the task runs it imports files to specfic folders. If I run it manually a cmd window appears, and the files are indeed imported, when I let the task run, nothing happens. – questionador Jul 01 '19 at 10:42

0 Answers0