Export Each Layer including frames seperatly

I have one .ase File which contains all the animations of my character, the character is divided into different layer, each layer contain a part of the character so for example there is one layer containing the body another one the head and so on. I now want to export each layer into a seperat png file. This png file should include all the frames of that layer. I already tried with the script posted by dacap.

aseprite='C:/Program Files/Aseprite/Aseprite.exe'

for layer in $("$aseprite" -b -list-layers Player.aseprite) ; do
  "$aseprite" -b -layer "$layer" Player.aseprite -sheet "out/$layer.png" --data "data/$layer"

But when I try to execute it, it correctly saves the first layer as I want. But for all the other layers it says:
“Cannot save file “Name of the file” in the given location”.

Anyone know’s how to create such a script or how to fix mine?