Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
titleWindows Batch Script
langactionscript
@echo off
rem enable delayed expansion - used to resolve variable in loop
rem variable has to be used with '!' instead of '%'
setlocal ENABLEDELAYEDEXPANSION

rem adapt this path to your needs
set gptPath="C:\Program Files\beam\beam-4.9.0.1\bin\gpt.bat"

rem first parameter is a path to the graph xml
set graphXmlPath=%1
rem second parameter is a path to a parameter file
set parameterFilePath=%2
rem use third parameter for path to source products
set sourceDirectory=%3
rem the fourth parameter is a file prefix in for the target product name, typically indicating the type of processing
set targetFilePrefix=%4

set targetDirectory=%sourceDirectory%\output\
rem Create the target directory
md %targetDirectory%

rem double '%' in batch file and only a single '%' on command line
for %%F in (%sourceDirectory%\*.N1) do (
  rem '~fF' means absolute path of 'F' 
  set sourceFile=%%~fF
  rem '~nF' means file name without extension of 'F'
  set targetFile=%targetDirectory%\%targetFilePrefix%_%%~nF.dim
  set procCmd=%gptPath% %graphXmlPath% -e -p %parameterFilePath% -Ssource="!sourceFile!" -t "!targetFile!"
  call !procCmd!
)

...