Knime with windows prompt command

Hi guys, I’ve a need using windows command prompt just to send a alert mnessage when the flow finish. It’s a local machine to process the flow and all examples with external tools neet to pass a file or data.

For windows command prompt, given example:

%windir%\system32\cmd.exe MSG Computer message

Do you know how to make it works?

Thanks,

Denis Iongbloed

Hi @denisfi , have a look at this

In place of the command written in the Table Creator, you can write any commands you want, with any data you choose.

image

It writes your command out to the commandfile.cmd file with the folder location being defined in the Binary Objects to Files node.

Execution is performed by my Open File or Folder component (which uses java to execute the cmd file)

3 Likes

You created this node, right? but inside the knie, it’s possible to execute the cmd file directly or you need to build some java script to do it?

Tks, Denis

Sure, Denis! To send an alert message using the Windows command prompt when the flow finishes,

you can use the command: %windir%\system32\cmd.exe /c MSG * “Flow Finished!”.

Cool! I imageneted it, but with node I can use? Use “external tool”?

How to set it?

Tks again, Denis

Hi @denisfi , I believe you’ll need either Java (or I guess Python should be able to do it too) or an extension to run a command file from KNIME.

I used the java approach in that component. I built that back when I first started using KNIME, based on an idea that @qqilihq had posted, as you can see here,

and it will do what you are asking without any other nodes installed, as demonstrated in the workflow example I posted.

There is at least one extension node that can run shell scripts too, which may work for you:

Possibly the “External Tools” node can also work for you

but it still requires you to have the command in a script. Did you try the demo workflow to see if it works for you?

I don’t know of any other “native” ways of executing a command script.

1 Like

I tried these nodes, but always neet to send data, not a simple command script. For me, it is important to know on frontend that the flow ran and show a message to identify if its ok or error, with the name from this workflow.

I’ll see the post as you gentilly pass before and try it.

Thanks again!

I’ve packaged up a new component for you @denisfi :slight_smile:

4 Likes

Than you very much!!! It’ll help me a lot!

1 Like

@takbb, when I run the flow in debug mode (batch), some error appears using the component.

Ah, I didn’t realise you were running in batch mode. I haven’t tried using using this in batch mode, and unfortunately the calls made by java here used the java awt “desktop” calls so I can understand why they wouldn’t work when there is no UI. Before I go trying to think of an alternative, can you confirm that the component works when executed within a (non batch) desktop workflow.

ok, and thaks again for your time and expertise!

I’ve made a change.

Try refreshing (updating ) the component. It now uses a different mechanism. I haven’t tested it in batch, but it should now be able to execute in a batch (headless) environment.

I can’t say for sure that the Windows MSG command will work in that environment though!

1 Like

Hi @takbb , I update the link and from de UI, works fine.

image


image

From this node, it selft open the explorer files, but not send message from UI.

Maybe I forgot to set a message from flow variables to insert into this component.

I’ll try now using batch process and I´ll return for you soon…

Your components are amasing… I saw the folder with a loto of them…

Thanks, Denis

3 Likes