OL Learn

Launching .bat file from Workflow


I am trying to use the External Program plugin in workflow. Unfortunately, I am not getting the expected outcome, I am pointing it a .bat file and when the workflow runs nothing happens, no cmd window opens and the process just continues on thinking it has run successfully (which it hasn’t) any ideas would be appreciated!



Hey Alex,

Have you tried running your process both in debug mode and as a service? Knowing if one method works but not the other would help us troubleshoot.

Are you running the services under an account with administrator rights? Are you logged into Windows as a local admin?

You can also try logging the program output to a variable(it’s a setting in the external program plugin), you might be getting a useful error that you aren’t seeing.

Hi Stephen,

We have encounter the same issue. the process can be run successfully in debug mode but failed as a service.
Failed to execute the .bat file when Workflow is run as service.
Can you please advise?

Thanks and Regards,

Hey JaniceTej,

It really depends on what exactly your .bat file is doing. When something works in debug mode but not in service mode that usually comes down to user rights.

Also if there is any kind of user-input required when you run the .bat file in debug mode, then it will fail as a service because it’s not possible to provide user input that way.

You might want to experiment with the Run DOS commands plugin instead. You should be able to mostly copy/paste the contents of your .bat file into that plugin.

Running a batch file is simple enough using the External Program action task in Workflow.

  • In the Executable File field, enter: C:\WINDOWS\system32\cmd.exe
  • In the Parameters field, enter: /C “C:\BatchFiles\MyBatchFile.bat” (rename file and path accordingly)
  • In the Start in field, enter C:\BatchFiles (rename path accordingly)

You should also store the program’s output in a variable or a Job Info and log that output so you can check the logs for the result of the operation after it has run in service mode.

That’s pretty much it. In service mode, the batch file will run using the service’s credentials, so make sure those credentials allow the batch file to perform whatever tasks it needs to do.