Due to recent updates, all users are required to create an Altair One account to login to the RapidMiner community. Click the Register button to create your account using the same email that you have previously used to login to the RapidMiner community. This will ensure that any previously created content will be synced to your Altair One account. Once you login, you will be asked to provide a username that identifies you to other Community users. Email us at Community with questions.

Execute Program

Stefan_EStefan_E Member Posts: 53 Maven
edited November 2018 in Help
Does the 'Execute Program' work? I enter a command such as 'cmd start dir' as a trial; RM would just hang in the 'Execute Program' operator, waiting until I kill it. This is on Windows-7.

Greetings                Stefan

Answers

  • landland RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 2,531 Unicorn
    Hi,
    yes this behavior is correct. The RapidMiner operator waits until the called program is finished. Otherwise you cannot ensure that you can use the results of the executed command.
    And if you just start cmd, this will open a shell which is only terminating when you type exit or close the window. To execute a shell command you have to use the parameters of cmd:  "cmd /Q /C dir" for more information, please type cmd /help in a shell.

    Greetings,
    Sebastian
  • Stefan_EStefan_E Member Posts: 53 Maven
    Hmm...

    the problem is that no shell opens - so there is nothing I could close  ??? Same behavior btw., if I type "cmd /Q /C dir". The only remedy is to shoot down RM.

    Stefan
  • landland RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 2,531 Unicorn
    Hi,
    I will verify that.

    Greetings,
      Sebastian
  • landland RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 2,531 Unicorn
    Hi,
    I can confirm this problem. We will trace it down as soon as possible. Don't know why this occurs only on Windows 7.

    Greetings,
      Sebastian
  • ManitouManitou Member Posts: 4 Contributor I
    Sebastian Land wrote:

    Hi,
    I can confirm this problem. We will trace it down as soon as possible. Don't know why this occurs only on Windows 7.

    Greetings,
      Sebastian
    Hi there, I am new to this forum, allthough I have been using Rapid Miner for a couple of weeks already. It's brilliant and I have never seen such a might open software package. Thank you for that........

    My question ist: Does this problem just occur on Windows 7. I am using Vista and have the same problem as the person above that no shell at all opens when I use the cmd command on the excecute program operator.

    What would be the excact syntax for the operator? Would it be "cmd" or 'cmd'? Please do not mind my stupid questions but I belong to the generation who are not really familiar with shells..........

  • SebastianLohSebastianLoh Member Posts: 99 Contributor II
    Hi folks,

    at least under windows 7, this is not a bug, it's a feature!

    I can not talk about windows vista, but under windows 7 though the command is executed without opening a shell window.

    For example if you execute

        cmd /c java -version

    you get the output in the log window:

     
    Apr 22, 2010 9:14:49 AM INFO: Process starts
    Apr 22, 2010 9:14:50 AM INFO: Execute Program: stderr:
    java version "1.6.0_18"
    Java(TM) SE Runtime Environment (build 1.6.0_18-b07)
    Java HotSpot(TM) Client VM (build 16.0-b13, mixed mode, sharing)
    Apr 22, 2010 9:14:50 AM INFO: Execute Program: stdout:
    Apr 22, 2010 9:14:50 AM INFO: Program exited succesfully.
    Apr 22, 2010 9:14:50 AM INFO: Saving results.
    Apr 22, 2010 9:14:50 AM INFO: Process finished successfully after 0 s

    The instructions for windows users in the operator description were a little bit confusing and partly wrong. I just corrected it, so with the next update it will be correct.

    @Manitou

    Try this process here, does it work under vista?

    It should print the java version in you log and open the notepad editor.

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="5.0">
      <context>
        <input/>
        <output/>
        <macros/>
      </context>
      <operator activated="true" class="process" expanded="true" name="Process">
        <process expanded="true" height="190" width="346">
          <operator activated="true" class="execute_program" expanded="true" height="60" name="Execute Program" width="90" x="246" y="30">
            <parameter key="command" value="cmd /c java -version"/>
          </operator>
          <operator activated="true" class="execute_program" expanded="true" height="60" name="Execute Program (2)" width="90" x="239" y="249">
            <parameter key="command" value="cmd /c notepad"/>
          </operator>
          <portSpacing port="source_input 1" spacing="0"/>
          <portSpacing port="sink_result 1" spacing="0"/>
        </process>
      </operator>
    </process>
    Ciao Sebastian
  • ManitouManitou Member Posts: 4 Contributor I
    Hi Sebastia,

    cheers, indeed it did open notepad as well told me in the log window of RM which Java version curretly is installed on my machine. So I can confirm that it that the things it is supposed to do under windows vista too.

    Thanks.

  • dragoljubdragoljub Member Posts: 241 Contributor II
    Hey Everyone,

    I would like to execute a command line program in windows 7 however my directory tree has spaces in it.

    I have tried all versions of quotation of the command line and nothing seems to work. How do I send quote characters to the java interpreter?

    Thanks,
    -Gagi
  • SebastianLohSebastianLoh Member Posts: 99 Contributor II
    Hi gabi,

    did you try

      cmd /c C:\"Program Files"\"Internet Explorer"\iexplore.exe

    ?

    Ciao Sebastian

    Ps. For a process search for "Execute Program on Windows 7" in the MyExperiment" plugin,
  • dragoljubdragoljub Member Posts: 241 Contributor II
    You know I did try that but for some reason it was not working. By random trial and error I got this to work. Looks like the " may be escaped but then not on the closing end of the folder name! I have no idea why this works.

    Example Below (I'm running Windows 7 x64)

    Start a program with 3 options and two file names. Notice the double backslash!? Why does this work?

    cmd /c start program_name -a 1 -b 2 -c 3 C:\Users\gagi\Work\\"Folder Name"\Data\A.dat C:\Users\gagi\Work\\"Folder Name"\Data\B.dat

    I'm glad it works but still have no idea why. Also adding a slash before the end quote makes it fail parsing.

    -Gagi  :)
Sign In or Register to comment.