Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

Execute .bat file from LC

Avatar

Level 8
Level 8

Hi all,

I have a situation where I need to execute a .bat file from LC. Is that possible and how should I approach this?

Thanks in advance

Cheers

Kim Christensen

Dafolo A/S

4 Replies

Avatar

Level 10

Use the following syntax to execute the batch file.

Avatar

Level 8
Level 8

Hi Nith,

I tried your suggestion – however it does not work as I expected. The process seems to execute – however nothing of what is in the bat file is done:

E.g. I have this bat file – and when I run it with your suggestion in LC nothing happens – when I run it on the server I get the copy of the file:

I have added the following in my Execute Script service action:

Runtime.getRuntime().exec("cmd /c c:\\file.bat");

The .bat file looks like this:

ECHO OFF

COPY "C:
installer_debug.txt" "C:
new_installer_debug.txt"

PAUSE

When I run the cmd /c c:\\echoName.bat in the "Run" window on the server it executes as expected, but not when I invoke the Process through Workbench.

What am I doing wrong – do I need to setup something on my server (Systems is: JBoss Turnkey, MySQL,  LC 2.5)?

\Kim

Avatar

Level 10

Your batch file should be placed in server or in a shared folder where the

server has access.

Avatar

Level 8
Level 8

Hi again,

The .bat file is located here: c:\file.bat

on the server.  When I invoke the process through Workbench nothing happens, but when I execute "cmd /c c:\file.bat" in "Run" on the server then the .bat file is executed.

Cheers

Kim Christensen

Dafolo A/S