I have the task of creating a batch file that will run FME scripts that update data layers to AGOL. I am completely unfamiliar with .bat and have not found anything online that really summarizes the commands to do this.

Does anyone here have experience with creating a bat file that will run FME scripts in succession of each other?

I would like the file to run whether or not the FME files ran successfully or not, however it would be a bonus if I could somehow see if any of the FME scripts failed.


I think you have a couple of options here.

Firstly run the workspace (script) in Workbench and check out the log file. The very first lines of the log window will show you what the command is to run the workspace in a bat file. So you can simply copy and paste that into a bat file.

If you need to pass parameters into the translation then you would use filename.bat [parameter value] and in the command replace the parameter values with %1, %2, etc

eg C:\apps\FME2018.1\fme.exe MyWorkspace.fme --MyParameters %1

However, another - maybe better - method is to use a WorkspaceRunner transformer. Basically you create a new FME workspace that simply has a Creator transformer to start the process, plus a WorkspaceRunner that points to the workspace to be run. You can use the dialog of the WorkspaceRunner transformer to pass parameter values.

There's a good article/demo of the technique on the Safe knowledge base.

Which method you use depends on why you are creating a bat file. If it's for scheduling a task, then that's a good solution (although FME Server if you have it has built-in scheduling tools). But if you're just wanting to start a process that calls a number of workspaces in turn, then the WorkspaceRunner is the best solution.

Another benefit of the WorkspaceRunner is that you can wait for the process to complete, and then get a result on whether it has passed or failed. So by stringing together multiple WorkspaceRunners, you can call a chain of workspaces to run, stopping at any point if an individual workspace failed.

I believe you can get feedback from a process in a bat file, to see if it failed, but that would be failed in the "crashed" sense; it wouldn't check to see if the FME process had completed successfully, but had a failure message (eg couldn't write to a DB because of the wrong password).

  • 1
    Thank you so much Mark, I am going to try the Workspace Runner first. I really appreciate the info here- Cheers! – Jeff Jun 28 '18 at 16:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.