It is possible to run LibreCAD from command line.
But I think it's not possible to switch layers on/off trough this process.
I think this was intended to bulk convert a bunch of DXF files to PDF.
Don't remember yet if there is a user documentation anywhere.
Possibly related:
https://forum.librecad.org/Invoking-Script-from-Command-line-tp5718481p5718483.htmlBut you can ease the process by using the Layer List Filter.
By using a smart layer name scheme, you can use the filter to hide unwanted layers and use the tool buttons to enable/disable all visible layers with one click.
see
https://librecad.readthedocs.io/en/latest/ref/widgets.html?layer-list-dock#layer-list-dockor
https://forum.librecad.org/Wish-possiblity-to-group-the-layers-to-work-with-options-or-variants-tp5718532.html
investing less than half an hour into Search function can save hours or days of waiting for a solution