Running headless macro with Directory as passed argument

I’m trying to develop a --headless command that passes a directory to a macro as the input on MacOS

Current command
/Applications/ --ij2 --headless --console -macro ./RunBatch.ijm 'input="/Users/myname/Desktop/testfiles"'

The RunBatch.ijm

arg = getArgument()
print("Running batch analysis with arguments:")
runMacro("testthreshold.ijm", arg )
eval("script", "System.exit(0);");

The testthreshold.ijm starts with


I can’t seem to pass the input argument in the initial --headless command to the macro.

I’ve tried to use input = arg; in the testthreshold.ijm, but that did not work.

I will have to do this with output as well, but thought it simpler to start with just input.

Any ideas?