US and Worldwide: +1 (866) 660-7555
Results 1 to 5 of 5

Thread: how to run a batch file (windows environment)

  1. #1
    Join Date
    Aug 2013
    Posts
    3

    Default how to run a batch file (windows environment)

    Hi,
    I think i am getting a hang of Penatho ETL (Community version) and i like it so far..
    one hick up while working on it is: how to run a batch file (windows environment) using transformation/job?

    I have searched on the internet and Pentaho Wiki and i quite didn't understand how to do it though. Had gone through Execute a process (link below) and couldn't figure how to run a batch file using this. Not sure if this is even right direction for it..

    http://wiki.pentaho.com/display/EAI/Execute+a+process

    Why do i want to run a batch file? Two things:
    1. I do not know if this is my system that MAIL utility does not work in community version or something else; so want to use a command line utility to send email after transformation is done. Tested mail on my system through telnet and it works with same smtp domain and port.
    2. Before loading a flat file; want to change the encoding version through a command line utility and then load it.

    Thanks

  2. #2
    Join Date
    Jun 2012
    Posts
    3,372

    Default

    Did you follow the link to the Shell job entry given on that Wiki page?
    There you are reminded, that you can't execute a batch directly.
    You must execute a shell, that in turn is able to execute a batch.

    SMTP Mail is available in the Community Edition as well, so no need to look for a workaround.
    And encoding can be specified when using Text input steps, if it's one of the supported encodings.
    So no external treatment via recode necessary either.
    pdi-ce-4.4.0-stable (with patches)
    java 1.7.0_65 (OpenJDK)
    ubuntu 14.04 LTS (x86_64)
    timezone CET / CEST
    sig updated 2014-11-16

  3. #3
    Join Date
    Aug 2013
    Posts
    3

    Default

    thanks marabu for the reply.
    i have to figure out how to run a batch file through a shell in windows.. never did that.. do you mind me asking if I need any java, perl scripting for this? or is it more of a shell scripting?

    For some reason MAIL utility didnt email but said successfully finished; have to dig more into this..
    Encoding of file i have is UCS-2 Little Endian; which i could not find in Pentaho(unless there is a equivalent ISO name to it)

    Thanks for your help.


    Quote Originally Posted by marabu View Post
    Did you follow the link to the Shell job entry given on that Wiki page?
    There you are reminded, that you can't execute a batch directly.
    You must execute a shell, that in turn is able to execute a batch.

    SMTP Mail is available in the Community Edition as well, so no need to look for a workaround.
    And encoding can be specified when using Text input steps, if it's one of the supported encodings.
    So no external treatment via recode necessary either.

  4. #4
    Join Date
    Jun 2012
    Posts
    3,372

    Default

    How do you execute a batch file without Kettle (the ETL tool you are using now) ?

    One way is to run "%COMSPEC% from the start menu, which executes CMD.EXE on most systems.
    While CMD.EXE is an executable, foo.cmd and bar.bat are not.
    To execute a batch file from Kettle you will therefore create a process from the executable CMD.EXE.
    CMD.EXE /C your.cmd tells your command processor (shell) what batch file to interpret.
    The command line switch /C assures, that no command prompt will be kept open after the batch file is processed.
    Omit /C and watch your desktop being populated by lots of open command prompt windows until windows faints.

    You can use a Text File Input step with encoding UTF-16LE to read your UCS-2 encoded text files.
    pdi-ce-4.4.0-stable (with patches)
    java 1.7.0_65 (OpenJDK)
    ubuntu 14.04 LTS (x86_64)
    timezone CET / CEST
    sig updated 2014-11-16

  5. #5
    Join Date
    Aug 2013
    Posts
    3

    Default

    Sorry for the delay. Thanks marabu. I shall try to see if i can get it to run in windows on my side..


    Quote Originally Posted by marabu View Post
    How do you execute a batch file without Kettle (the ETL tool you are using now) ?

    One way is to run "%COMSPEC% from the start menu, which executes CMD.EXE on most systems.
    While CMD.EXE is an executable, foo.cmd and bar.bat are not.
    To execute a batch file from Kettle you will therefore create a process from the executable CMD.EXE.
    CMD.EXE /C your.cmd tells your command processor (shell) what batch file to interpret.
    The command line switch /C assures, that no command prompt will be kept open after the batch file is processed.
    Omit /C and watch your desktop being populated by lots of open command prompt windows until windows faints.

    You can use a Text File Input step with encoding UTF-16LE to read your UCS-2 encoded text files.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •