Hurricane for Autodesk® AutoCAD®
Three layer jobs come up again and again on the forum, and all three are scriptable through Hurricane: clearing junk layer filters, selecting everything on one layer, and setting layer states (on/off/freeze/lock) across many drawings.
-LAYER-LAYER is the no-dialog version of the Layer command. Its options cover everything a script needs: Make, Set, New, On, OFf, Freeze, Thaw, LOck, Unlock, COlor, and more. For example, to freeze a layer and turn another off:
-LAYER ;Freeze a layer (wildcards allowed, e.g. XREF*) F DEFPOINTS ;Turn off every layer starting with DIM OFF DIM* ;The next line is intentionally blank: it exits the command
Keep comments on their own lines, starting with a semicolon. A comment after a value on the same line is sent to AutoCAD as part of the value (see How do I add comments to my scripts?).
Inherited drawings often carry dozens of nested layer filters that clutter the Layer Manager. The catch: most "delete filters" routines prompt, and a prompt stalls an unattended batch. The Hurricane forum hosts a no-prompt version that just removes them all:
delfiltersall.lsp from Delete all Layer Filters on the Hurricane Forum, a script-safe build that deletes every layer filter with no questions asked.
There's no native command-line "select by layer", but the classic SSX (Selection Set by example) routine does it, and is handy inside scripts. The forum has a copy since Autodesk dropped it after R14:
SSX.zip from Selecting by layer in a script (SSX). A no-LISP workaround also works: -LAYER Lock every layer except the target, then SELECT ALL. Locked layers are skipped.