Access files via File Parameter Plugin in a scripted pipeline

Hi Community,
We are trying to get the File Parameter Plugin to work in a scripted non-declartive pipeline.
While every thing works with the standard declarative example (see File Parameter Plugin), our naive scripted version fails.

script
{
  properties([
    parameters([
      base64File(name: 'FILE', description: "File to read")
    ])
  ])
}
  stage("Example")
  {
    node("my_label")
    {
      withFileParameter('FILE') {
      sh 'cat $FILE'
    }
  }
}

This fails with the following error:
java.io.IOException: CreateProcess error=2, The system cannot find the file specified
17:55:57 at java.lang.ProcessImpl.create(Native Method)
17:55:57 at java.lang.ProcessImpl.(Unknown Source)
17:55:57 at java.lang.ProcessImpl.start(Unknown Source)

Any help is appreciated! Thank you!

”CreateProcess”… are you running that on Windows? Perhaps you don’t have a sh shell installed. Try bat 'TYPE "%FILE%"' instead.

Thanks, you are my hero! :person_facepalming:

Replacing sh ‘cat $FILE’ with bat “type $FILE” works for Windows nodes…