Hitachi Vantara Pentaho Community Forums
Results 1 to 7 of 7

Thread: Execute Batch-File (OS windows)

  1. #1
    Join Date
    Sep 2005
    Posts
    1,403

    Default Execute Batch-File (OS windows)

    I want to execute a batch file. I used the Shee-Function.
    After that I want to make a transformation.


    Transformation-->File Exist-->Shell (call.Bat)--> Transformation



    My Problem: The Batch-File will not return, so the next transformation will not start.



    Can I Use the evaluation-Funtion? How?
    Which problem do I have?



    thx a lot,



    Sven

  2. #2
    Join Date
    Nov 1999
    Posts
    9,729

    Default RE: Execute Batch-File (OS windows)

    Hi Sven,

    .bat files are the worst! The main thing to remember is to make sure that the .bat file does *not* put anything out on the std output.

    @echo off and redirect all output from applications to a logfile or something.

    Evaluation is basically a piece of JavaScript that need to end with a condition.
    This is the boolean result of the evaluation (true of false: green or red arrow)

    The fields to use in your evaluation are described in paragraph 7.2.10 of the Chef manual : Chef-2.2.2.pdf in the Documentation section.

    Hope this helps,

    Matt

  3. #3
    Join Date
    Nov 1999
    Posts
    459

    Default RE: Execute Batch-File (OS windows)

    Hi Sven,

    calling batch files with shell needs the good old dos command processor ;-)

    shell ("command.com /c call.bat")

    Mind the "/c" that lets the shell close after finishing the call.bat.
    Also ensure command.com is found in the path or add the path like: shell ("C:\path1\command.com /c C:\path2\call.bat")

    Thanks for rembering me to my first DOS 1.1 adventure a long time ago with no hard drive but two disk drives in my PC ;-)

    Cheers,
    Jens

  4. #4
    Join Date
    Nov 1999
    Posts
    459

    Default RE: Execute Batch-File (OS windows)

    Reply to my self:

    I just tested this with Chef - a simple c:\test.bat works, also without the command.com and also with giving output (BTW: I didnÂÂ't get started this with c:\windows\system32\command.com may be "/c" is converted to "\c" also in parameters?).

    my simple test.bat:
    @echo off
    echo o.k. >c:\ok.txt

    Could you post your batch?

    Cheers,
    Jens

  5. #5
    Join Date
    Nov 1999
    Posts
    9,729

    Default RE: Execute Batch-File (OS windows)

    Yes, but this bat file is NOT producing output.
    Put something like

    echo TheDailyWTF: Brillant

    in there, and it will not return. (last time I checked :-))

    Cheers,
    Matt

  6. #6
    Join Date
    Sep 2005
    Posts
    1,403

    Default RE: Execute Batch-File (OS windows)

    Hi,

    i tried do call one sql-File wiht sqplus, which was generated from another tool.
    The batch-File is like this

    @echo off
    command.com /c sqlplus XXX/XXX@DB @my.sql >logfile.log

    The Header of the my.sql ist like

    set feednack off
    set echo off
    set termout.off

    A lot of Create External-table-Statements

    In the future i want our company to use spoon Text file input. But in this project i have to use the external tables but i want Kettle for the outher operations.

    Thx a lot,

    Sven

  7. #7
    Join Date
    Nov 1999
    Posts
    9,729

    Default RE: Execute Batch-File (OS windows)

    That should work.
    Did you check that the my.sql has an "exit" statement at the back?
    Otherwise it will indeed stay blocked inside sqlplus.

    Matt

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.