Slotted Brass Screw Types
A few options, in no particular order:

Drill pilot hole first

Take the batten off the wall, drill pilot hole, replace. Then you can use whatever size screw is necessary.

Use a flexible drill shaft

These plug into an existing drill and let you get into tight places.



Use double-sided tape or adhesive

Not as strong, but depending on the application may be an easy way to accomplish the goal of preventing shelves from coming out 

Use an angle bracket

Use a couple small angle brackets to drill into the bottom of the shelf.