Skip to main content
Scripting Guide

AutoCAD Batch Scripts: Which Commands Work at the Command Line?

Published June 2026  |  74mph Solutions

The most common reason an AutoCAD batch script stops working is not a typo or a logic error. It is a dialog box. You put a command in your script, the script runs, and instead of executing silently it pops open a dialog that waits for mouse input — and the entire batch process stalls.

AutoCAD has hundreds of commands. A significant portion of them open dialogs by default. Knowing which commands work directly at the command line, and which need special handling, is foundational knowledge for anyone writing batch scripts or using automation tools like Hurricane.

Why Dialog Boxes Break Scripts

AutoCAD scripts are plain text files that feed keystrokes to the command line one line at a time. When a command opens a dialog box, it stops waiting for mouse clicks instead of keyboard input. The script has no way to click a button, so it hangs there indefinitely. The batch job stalls on the first drawing and never continues.

This is not a bug — it is how AutoCAD is designed. The fix is to either use a command that does not open a dialog, or to use a variant of the command that suppresses the dialog and provides the same functionality through the command line instead.

The Hyphen Prefix: Your Most Important Tool

Many AutoCAD commands that normally open a dialog box have a command-line equivalent that you get by prefixing the command name with a hyphen. This is one of the most useful and underused features in AutoCAD scripting.

Normal command (opens dialog)Hyphen variant (command line only)
LAYER — opens Layer Properties Manager-LAYER — set, create, freeze, thaw from command line
INSERT — opens Blocks palette or dialog-INSERT — insert block silently with all parameters on command line
PURGE — opens Purge palette/dialog-PURGE — purge silently, no confirmation required
PLOT — opens Plot dialog-PLOT — plot with all settings specified on command line
HATCH — opens Hatch Creation ribbon tab-HATCH — apply hatch pattern with command-line prompts
BLOCK — opens Block Definition dialog-BLOCK — create block with command-line prompts
RENAME — opens Rename dialog-RENAME — rename layers, blocks, styles from command line
ARRAY — opens Array dialog (2012+)-ARRAY — create arrays with command-line prompts
XREF — opens External References palette-XREF — attach, detach, reload, bind xrefs from command line
VIEW — opens View Manager-VIEW — save and restore named views from command line

Quick reference: The complete list of hyphen-variant commands, plus the status of every AutoCAD command from 2000 through 2026, is in the AutoCAD Command Reference. It covers all 250+ commands with dialog status, hyphen variants, and what changed in each major version.

The Five Commands Every Batch Script Needs

1. -PURGE

The most-used command in Hurricane batch scripts. The normal PURGE command has opened an increasingly elaborate dialog over the years. The hyphen version runs silently with a single line:

-PURGE All * No

This purges all unused items (blocks, layers, linetypes, dimension styles, text styles) in one pass, with the wildcard * matching everything and No answering the "Verify each item?" prompt. Run it before QSAVE and after every major editing operation for clean, minimal drawing files.

2. -PLOT

The normal PLOT command opens a multi-tab dialog with plotter, paper size, layout, scale, and output settings. -PLOT walks through every one of those settings as command-line prompts instead. It is verbose to set up the first time, but once recorded it runs identically across every drawing in the batch.

The easiest way to capture the exact prompt sequence is to run -PLOT manually once, then use Hurricane's Command Capture tool to record it. Hurricane will store the full sequence and replay it across your entire file queue.

3. -INSERT

Used for inserting blocks in batch scripts — title blocks, standard details, or any named block. You specify the block name, insertion point, X scale, Y scale, and rotation angle all on the command line:

-INSERT blockname 0,0 1 1 0

Set the system variable ATTDIA to 0 before inserting attributed blocks, otherwise AutoCAD will open the attribute fill-in dialog even when using -INSERT.

4. -LAYER

Layer management without ever opening the Layer Properties Manager. Common uses in scripts:

5. -HATCH

From AutoCAD 2011 onward, the normal HATCH command opens a ribbon tab that requires interaction. -HATCH provides the same functionality with command-line prompts for pattern name, scale, and angle. This is essential for any script that applies or standardizes hatch patterns across drawings.

System Variables That Suppress Remaining Dialogs

Some commands do not have a hyphen variant but can still be used in scripts by setting system variables at the top of the script to suppress their dialogs.

System variableSet toWhat it suppresses
FILEDIA0File open/save dialogs for EXPORT, IMPORT, SAVEAS, BMPOUT, WMFOUT, STLOUT, PSIN, PSOUT, ACISIN, ACISOUT and others. The command then prompts for a filename on the command line instead.
ATTDIA0The Attribute dialog that appears when inserting blocks with attributes via INSERT or -INSERT.
CMDDIA0Plot and Hatch dialogs in older AutoCAD versions. In modern versions, use -PLOT and -HATCH instead.
EXPERT1–5Confirmation and warning dialogs. Higher values suppress more prompts. Use with caution — some confirmations exist for good reason.

Add these at the very start of your script and reset them at the end:

SETVAR FILEDIA 0
SETVAR ATTDIA 0

Then at the end of the script: SETVAR FILEDIA 1

Commands That Changed in Recent Versions

Several commands that were command-line compatible in older AutoCAD versions gained dialog interfaces in more recent releases. If your scripts worked in AutoCAD 2010 but stopped working in 2015 or later, one of these changes is a likely culprit.

CommandChanged inWhat changedFix
HATCH / BHATCH2011Now opens Hatch Creation ribbon tab instead of dialog promptsUse -HATCH
ARRAY2012Now opens Array ribbon/dialog with three array typesUse -ARRAY
GROUP2012Now opens Object Grouping dialogUse -GROUP
INSERT2020Now opens the Blocks palette instead of the classic Insert dialogUse -INSERT (unchanged)
PURGE2020Enhanced Purge palette with preview; dialog interaction requiredUse -PURGE All * No (unchanged)

What Is and Is Not Scriptable — A Simple Rule

If a command responds entirely to keyboard input and outputs results to the command line or drawing, it works in scripts. If it opens any kind of window, palette, panel, or file selector that requires mouse input, it does not work in scripts without one of the workarounds above.

Commands that cannot be scripted at all include: OPEN, OPTIONS, APPLOAD, PROPERTIES, DSETTINGS, FILTER, QSELECT, REFEDIT, SPELL, TOLERANCE, UCSMAN, and VLISP. These open dialogs with no command-line equivalent and no system variable override. Design your scripts around them rather than through them.

The New -FIND Command in AutoCAD 2026

One addition worth highlighting for 2026 is the -FIND command. Through AutoCAD 2025, the FIND command always opened a Find and Replace dialog — making text find and replace completely inaccessible from batch scripts. AutoCAD 2026 added -FIND as a command-line alternative, which means you can now search and replace text strings across drawings as part of a Hurricane script without any dialog interruption. This is a significant capability that was simply not possible in earlier versions.

Full Command Reference: 2000 to 2026

For the complete picture — every AutoCAD command, its dialog status, its hyphen variant if one exists, its Hurricane compatibility rating, and what changed in AutoCAD 2024, 2025, and 2026 — see the AutoCAD Command Reference in the Hurricane FAQ. It covers all 250+ commands from the original AutoCAD 2000 list plus all new commands through 2026, with color-coded filtering so you can see at a glance exactly which commands are safe to use in scripts and which need workarounds.

How Hurricane Handles This Automatically

Hurricane's Command Capture tool records any sequence of commands you type in AutoCAD — including all the prompts and responses for hyphen-variant commands — and turns them into a reusable batch script automatically. You do not need to memorize the exact prompt sequence for -PLOT or -HATCH. You run the command once manually, Hurricane captures every prompt and response, and that exact sequence is applied across every drawing in your queue.

The wizards for common tasks — Purge Wizard, PageSetup Wizard, Title Block Update Wizard — generate the correct command-line sequences automatically, with no need to know which variant to use.

Stop Writing Scripts by Hand

Hurricane's Command Capture records the exact command sequence from any AutoCAD session and turns it into a batch script that runs across all your drawings. Free trial, no time limit.

Download Free Trial Buy Now - $149/seat

Related: AutoCAD Command Reference: 2000–2026  |  How to Batch Purge AutoCAD  |  AutoCAD Batch PDF Export  |  AutoCAD Night Run  |  All Hurricane Features