Search code examples
batch-filepdfcmdparameters

Foldermill passing variables to a .bat file


I am using a program called Foldermill.

Foldermill identifies when a PDF is saved into a folder.

I have setup a rule so that when a PDF is saved into a folder, a .bat file is executed.

enter image description here

The .bat file should receive the filepath and filename from Foldermill:

enter image description here

However, no parameters are being received by the .bat file:

enter image description here

Is anyone able to help me troubleshoot?


Solution

  • You can think of subroutines as smaller scripts that have been embedded in your main script. They get their own set of parameters, so the %1 and %2 that you have there are actually the parameters that were passed when you ran call :function. Since your code didn't forward along any of the parameters, your subroutine doesn't know that they exist.

    To get around this, you can forward all of the arguments that were passed to the main script using %*.

    call :function %*